Transparancy

Neal Gafter neal at gafter.com
Wed Jul 7 12:47:57 PDT 2010


On Wed, Jul 7, 2010 at 12:41 PM, Pavel Minaev <int19h at gmail.com> wrote:

> > Those who have used them in other languages rarely think of them as a
> method body.
>
> And again I have to disagree. Most C# programmers, for one, would
> think of them in precisely that way, and they alone make up a huge
> part of "those who have used them in other languages", given the
> popularity of C#.


My experience is exactly the opposite.  In C# "this" is inherited from the
enclosing scope.  No members are inherited from the delegate object type
into the body of the lambda expression.


> Another very huge - probably even bigger, actually -
> group with "foreign lambda background" would be JavaScript developers,
> and they also tend to think of a lambda as some kind of function.
>

In Javascript, the meaning of "this" can be either lexical at the point of
definition of the lambda or inherited from an object to which it is
attached.  That's confusing enough that I don't think it is something to
emulate.

Indeed, can you give an example of a popular language which 1) has
> explicit "return", 2) has lambdas, and either 3) does not allow for
> "return" in a lambda, or 4) allows for it, but only in the meaning of
> non-local return? The only one I can think of right off the bat is
> Smalltalk, and also Ruby to some extent (as it has different kinds of
> lambdas, with both local and non-local returns).
>

Besides the two you named I'd add Scala.


More information about the lambda-dev mailing list