Peter, our library makes extensive use of constructors without new as
a declarative way to build a class. Consider the example:
apple.EngravingGalleryController=
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
[email protected]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss