obsoleting the "new" keyword

Erik Arvidsson erik.arvidsson at gmail.com
Wed Jan 14 09:54:33 PST 2009


The *new* keyword makes thing more readable and I agree with both Kris
and Alex here that any class syntax we come up with should use *new*
to look and feel like "classes" as used today in ES.

I'm fine with making this optional since it would allow us to strip
"new " from the files we send over the wire ;-)

-- 
erik



2009/1/14 Alex Russell <alex at dojotoolkit.org>:
> 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
>
> _______________________________________________
> Es-discuss mailing list
> Es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>



-- 
erik


More information about the Es-discuss mailing list