@@new
Kevin Smith
zenparsing at gmail.com
Wed Jun 18 14:27:44 PDT 2014
>
>
> function F(x) { /* ??? the initial message really isn't explicit about
> what does here */ };
> F[Symbol.new] = {[Symbol.new](x) { //use an object literal to create a
> "method" kind of function
> var obj = super();
> obj.foo = x
> }}[Symbol.new].toMethod(F);
>
> which is quite different from you get for:
>
> function F(x) {this.foo=x};
>
Yes - the proposed semantics are quite different. The whole thrust of the
proposal is to fuse initialization and allocation, which is completely at
odds with how user-defined "classes" work in ES5.
I think Allen's suggestion of providing constructor arguments to @@create
is promising. That would allow the implementation to allocate and
initialize an object in one go, if desired. That seems to embody the
advantages of fusing initialization and allocation, without the headache
for the user.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140618/cf1202cf/attachment.html>
More information about the es-discuss
mailing list