Allen Wirfs-Brock wrote:
I certainly don't have any objection to have the procedural forms.
Personally, I think Object.define and Object.assign would be a good
names for the two concepts we have been talking about. Having such
functions would actually make it easier to explain corresponding
syntactic forms.
Object.define(Point,{
fromPolar(rho,theta) {
return new this(rho*Math.cos(theta), rho*Math.sin(theta))
}
});
is not as readable or writable as:
Point :={
fromPolar(rho,theta) {
return new this(rho*Math.cos(theta), rho*Math.sin(theta))
}
};
(note how "Point" gets visually lost in the procedural form. The eye
focuses on "Object.define" rather than the more important "Point")
Agreed, as noted I think the class statics use-case is strong (but if we
added class static declarative syntax, then maybe there's no strong
use-case for := left).
If := wasn't available I'd certainly want to have the procedural form
available.
Here I think we still disagree. := is not enough, it requires a
compiler. We want the API and it will see use including polyfills. Given
that projection, I'm not sure how much := use we'll see in the short
run, but I contend that := does not relieve us from having the API form.
All names are bikeshedable...
We were making progress, don't back off. Object.assign and Object.define.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss