Block lambda is cool, its syntax isn't

Herby Vojčík herby at mailbox.sk
Thu Jan 19 10:04:43 PST 2012


Andreas Rossberg wrote:
> On 19 January 2012 18:31, Axel Rauschmayer<axel at rauschma.de>  wrote:
>> Rationale: wouldn’t freezing by default be OK for 98% of the cases?
>
> Especially since the cases where you care most about short syntax are
> throw-away functions.
>
> The only sane reason I have seen for mutating a function is to set its
> prototype property. But who wants to write constructors as short
> lambdas?  Another use case is modelling C-style static variables as
> properties, but you cannot do that with an anonymous function anyway
> (I also don't regard it as particularly sane, but who am I to judge).

I'd say +1 for frozen shortcut functions. I also don't see the use case 
where mutating _the_function_ itself would be needed in such cases. It 
seems to me it is ok for big percentage of uses. If you need mutable 
one, use function.

Only fearful factor is when frozen one is used and in the runtime 
mutation is needed for something... but I could not find such use... 
wrapping such function is still possible, that is probably most 
possibility you need in runtime when monkey-patching or something.

Correct me if I am wrong.

> /Andreas


More information about the es-discuss mailing list