Allen's lambda syntax proposal

David-Sarah Hopwood david.hopwood at industrial-designers.co.uk
Mon Dec 8 21:57:22 PST 2008


Yuh-Ruey Chen wrote:
> Breton Slivka wrote:
>> On Sat, Dec 6, 2008 at 9:57 AM, Michael Day <mikeday at yeslogic.com> wrote:
>>
>>> (1) Expression lambdas: lambdas whose body is an expression.
>>>
>>> var x = lambda(y, z) y + z
>>>
>>> Solves the problem with completion leakage, solves the nested
>>> return/break/continue issue. However, quite limited in usage, and makes it
>>> difficult to use lambdas to replace functions as they can't contain loop
>>> statements. (Hello, recursion! :)
>> [snip]
>>
>> 2) It would be really nice to have a callable value that was
>> garaunteed not to have side effects. a lambda with an expression body
>> might not be that. Nevertheless, this would enable a parallelized
>> array "map" function that's safe to use. In the absence of "real"
>> multithreading, this kind of parallelism would be a boon for
>> applications like 3d games, or image processing.
> 
> This little comment got lost in the recent deluge of emails, but I too
> would really like some mechanism to avoid or see if a function causes
> side effects (and not just mutability).

That's unfeasibly difficult in full ECMAScript. Perhaps you could do it
starting with one of the secure subsets (which have immutable globals
and immutable prototypes of built-in types, for instance).

-- 
David-Sarah Hopwood



More information about the Es-discuss mailing list