What is the meaning of this?

Stefan Schulz schulz at the-loom.de
Fri Jan 29 09:34:31 PST 2010


Am 29.01.2010 18:12, schrieb Neal Gafter:
> Yes, there is widespread experience with Scala.  There is widespread
> experience with Ruby.  There is widespread experience with Smalltalk.
> There is widespread experience with Common Lisp.  These languages do
> indeed have transparent lambdas with non-local returns, and lambdas in
> those languages are nothing like "macros".

Smalltalk had no distinction between a block (like in Java) and a 
closure. Thus, it was a necessity to have non-local returns to not have 
to build awkward code for, e.g., an ifTrue:ifFalse: call. On the other 
hand, these non-local returns easily cause strange behaviour, e.g., when 
passing on a block between objects.

As Java does have explicit (transparent) blocks, I don't think 
transparent returns for common lambdas to be important or necessary. A 
control abstraction would cover these special cases and make users and 
designers of such API aware of the extraordinary behaviour.

> I don't know what the meaning of "this" is in a Groovy lambda.  Does
> anyone here know?

 From the Groovy definition:
"Closures always have a return value. The value may be specified via one 
or more explicit return statement in the closure body, or as the value 
of the last executed statement if return is not explicitly specified."

Cheers,
Stefan


More information about the lambda-dev mailing list