New private names proposal

Allen Wirfs-Brock allen at wirfs-brock.com
Wed Dec 22 10:07:28 PST 2010


On Dec 22, 2010, at 9:47 AM, Brendan Eich wrote:

> I'm still sympathetic to Oliver's objection that declaration-style "private #x, #y" does not "look generative" enough. Agree that the sigil addresses Mark's concern about confusing literal identifiers with lexically bound names, at a Perlish price.
> 
> David F. mentioned script concatenation. It happens freely on the web, and it is already biting us because of premature "use strict" usage where parts of the concatenation violate strict mode and most browsers don't check yet (https://bugzilla.mozilla.org/show_bug.cgi?id=579119).
> 
> To me this is the nail in the coffin for "compilation unit private name scope". I'm with dherman: lexical scope with a declaration for bindings, but it is not clear how to make the declaration look more generative. It seems important for similar things to look alike, and different-in-generativity/etc. things to look different (somehow).

Consider

function f() {
    var captured;  //this generates a new long-lived data store
    return {get value() {return captured}, set value(n) {captured=n}};
};

or

function g() {
    function inner() {};
    return inner;
}


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.

Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20101222/6ff21ba3/attachment.html>


More information about the es-discuss mailing list