[Python-ideas] a new lambda syntax
Stephen J. Turnbull
stephen at xemacs.org
Tue Oct 20 07:37:15 CEST 2009
Nick Coghlan writes:
> For myself, I don't actually agree it's a valid design rule - I think
> anonymous blocks have legitimate use cases (see Ars Technica's writeup
> of the Apple's new Grand Central Dispatch and C-level anonymous block
> system in OS X 10.6).
That doesn't look like what "anonymous block" means to me. It looks
like a lambda.
The difference is that an block resolves all its non-argument
references in the calling context, eg, as a C macro without arguments
would. But I don't see how you can assign a C macro to a variable and
call it at runtime....
Now, the cases that Ruby programmers I know always propose to me as
use cases for anonymous blocks rely on conventions for naming certain
objects used by their blocks (typically iteration variables), thus
avoiding the need to specify arguments for them. So a block seems to
be a conventional way of currying a more general function to the
context of a specific suite.
More information about the Python-ideas