obsoleting the "new" keyword

Alex Russell alex at dojotoolkit.org
Wed Jan 14 09:28:45 PST 2009


I think I'm w/ Kris on this:

I'd be in favor of the "new" protocol being exposed in a programmatic  
way, e.g.:

  var instance = someClassName.new();

In the same way that callables have their execution protocol exposed  
in call() and apply(). But I'd only favor this as a way to make the  
semantics of "new" clearer, rather than deprecating it. The "new"  
keyword makes at least one style of JavaScript much cleaner to read,  
and unlike other languages the ES 3 "new" also doesn't burden  
programmers with repetitive type notations on both sides of an  
assignment.

Regards

On Jan 14, 2009, at 9:21 AM, Kris Zyp wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I certainly hope not. A fundamental requirement of class sugar should
> be that it properly leverages "new".
> Kris
>
> Peter Michaux wrote:
>> The requirement that JavaScript needed to look like Java has long
>> been lamented. One of the key "looks" was the "new" keyword.  Many
>> people don't like the use of the "new" keyword. Although "new" is
>> here to stay, could we obsolete it when using a class sugar?
>>
>> Peter


More information about the Es-discuss mailing list