On Nov 19, 2011, at 9:42 AM, Jake Verbaten wrote:
> [snip]
>
> let Point = class {
> x: 0, //not really needed unless defining an object exemplar
> y: 0,
> new(x,y) {
> this.x = x;
> this.y=y;
> }
> };
>
> Yes this is better, could we go one step further and allow for
>
> Point.new(1,2)
>
> to work instead of new Point(1,2).
>
> If we just make the "new" method property create an instance of Point and
> pass that in as the this value then it would solve the need for having new
> <ObjectExemplar>.
>
> This would behave similarly to selfish's .new function.
You are pushing into spaces I want to avoid discussing right now because we
have a tendency to prematurely "rat hole" on such secondary issues without
resolving the primary question.
For now, the question is: is "new" a more desirable name than "constructor"
for the programmer provided code that is run by the new operator?
>
> The only issue is that all code that checks obj.constructor for the link will
> break because we no longer link the constructor anymore.
This falls into the area of "semantic details" that I alluded to. If a yes
consensus formed for the above question then it would be worthwhile to start to
dig into those details as we tried to move on to the next question: Is is
practical to use "new" as the name ...
Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss