New private names proposal

David Flanagan david at
Tue Dec 21 17:13:20 PST 2010

On 12/21/2010 04:25 PM, Brendan Eich wrote:
> Why does your expectation differ here compared to the following:
> MyAwesomeThing.prototype.myCoolFunction = function() {
> var cachedHotness = gensym();
> if (!this[cachedHotness])
> this[cachedHotness] = doExpensiveThing(this)
> return this[cachedHotness];
> }
> Is it because |private cachedHotness;| does not "look generative"?

I agree with Oliver: the private keyword is going to cause confusion. 
It looks like it is declaring something, not generating something.
A small step toward making the proposed syntax less Java-like (and 
therefore less likely to cause confusion) might be:

    use private cachedHotness;

A use directive feels vaguely more comfortable here to me.  It makes it 
clearer to the programmer that some kind of magic is going on.

But I confess that I haven't actually read Allen's proposal, so take 
this with a grain of salt.


More information about the es-discuss mailing list