Do modules make static unnecessary?

2013-07-01 Thread Juan Ignacio Dopazo
static properties of constructors have been used in JS mostly for transport and avoiding pollution of the global object. For example DOMPromise has Promise.any(), a static method. But if there were modules, any() would probably be better suited as an export: import {Promise, any} from @promise.

Re: Do modules make static unnecessary?

2013-07-01 Thread Brandon Benvie
On Jul 1, 2013, at 7:23 AM, Juan Ignacio Dopazo dopazo.j...@gmail.com wrote: So, in the light of modules, are static methods necessary? Static methods that use the |this| value to allow for constructor-side inheritance don't work correctly if simply imported from a module. See Array.from

Re: Do modules make static unnecessary?

2013-07-01 Thread Axel Rauschmayer
On Jul 1, 2013, at 17:15 , Brandon Benvie bben...@mozilla.com wrote: So, in the light of modules, are static methods necessary? Static methods that use the |this| value to allow for constructor-side inheritance don't work correctly if simply imported from a module. See Array.from and

Re: Do modules make static unnecessary?

2013-07-01 Thread Allen Wirfs-Brock
On Jul 1, 2013, at 9:41 AM, Axel Rauschmayer wrote: On Jul 1, 2013, at 17:15 , Brandon Benvie bben...@mozilla.com wrote: So, in the light of modules, are static methods necessary? Static methods that use the |this| value to allow for constructor-side inheritance don't work correctly if

Re: Do modules make static unnecessary?

2013-07-01 Thread Axel Rauschmayer
Similarly: @@create (which enables the subtyping of built-ins). subclassing Curious: is that an important distinction? To me, a

RE: Do modules make static unnecessary?

2013-07-01 Thread Domenic Denicola
From: Axel Rauschmayer [a...@rauschma.de] Curious: is that an important distinction? To me, a (sub)class is the implementation of a (sub)type. This doesn't make much sense in an ES context, where the only [types](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-4.3.1) are Undefined,

Re: Do modules make static unnecessary?

2013-07-01 Thread Axel Rauschmayer
Thanks Allen, Domenic, Andreas! Point taken. I now remember why I originally started to use the word “subtyping”: I wanted a verb that means deriving a new constructor from an existing constructor C. And I didn’t want to say “extend C”, because that term was already in use in the JS community

Make class constructors work with [[Call]] too?

2013-07-01 Thread Domenic Denicola
Given that all non-primitive built-ins behave this way, and that including `if (!(this instanceof ConstructorName)) { return new ConstructorName(...args); }` is a well-established best practice for ES5 code: can we just do this automatically for classes declared with `class`?