obsoleting the "new" keyword

Jeff Watkins watkins at apple.com
Wed Jan 14 11:34:36 PST 2009

Peter, our library makes extensive use of constructors without new as  
a declarative way to build a class. Consider the example:

Class.create(coherent.ViewController, {

     tabs: coherent.ListView('div.tabs ul', {
                             selectedIndexBinding: 'selectedTab',
                             animated: 'true'



Of course, you could also use coherent.ListView as a constructor to  
create an explicit instance. Under the covers, the OOP mechanism  
dispatches to a factory function which is used to ultimately create  
the member.

This is a lot like the Python meta-programming stuff, except I don't  
have an addToClass hook to use.

On 14 Jan, 2009, at 9:19 AM, 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20090114/0a3e1f25/attachment-0001.html>

More information about the Es-discuss mailing list