On Dec 22, 2010, at 10:07 AM, Allen Wirfs-Brock wrote:
> I don't see why
> private foo;
> is any more or less generative than:
> var captured;
> or
> function inner() {};
>
> They are all are declarative forms and all implicitly generate new runtime
> entities each time they are evaluated.
The function case looks different enough, even if special in no common way with
object and array initialisers or regexps. All four of functionos, object&array
initialisers, and regexp literals evaluated to fresh mutable objects, and
that's just something (or things) to know about the language.
For var captured; vs. private foo; there's a strange difference. These look
quite alike but the former allocates storage for one value and creates a
binding to that store. The latter does both of those things and generates a new
private name.
I agree that users could learn this and fold it into their knowledge of how the
language works. It would be another "thing to know". It still seems slightly
off because var x; (no initializer) uses undefined. The private name generation
is novel, but not conveyed by the syntax.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss