Tom Van Cutsem
tomvc.be at gmail.com
Sun Jun 15 23:45:21 PDT 2014
2014-06-13 19:21 GMT+02:00 Allen Wirfs-Brock <allen at wirfs-brock.com>:
> Anotherconcern I have with @@new, it that it exposes two extension points,
> @@new and @@create, on very constructor. I'm afraid that it wouldn't be
> very clear to most ES programmers when you should over-ride one or the
Smalltalk has both extension points (#new and #initialize). I think JS
programmers could handle this just as well.
> Finally, let's say that for ES6 we eliminate [[Construct]] without adding
> @@new. If after some experience we find that @@new is really needed we can
> easily add it in a backwards compatible manner.
By that time, the community will have developed its own set of
work-arounds, as it always does.
In any case, I believe you're probably right that @@create + constructor
invocation is sufficient for most use cases. The crucial step is that if
the constructor returns an object, this is the object returned by |new
C(...args)|. This way, the constructor can always return a cached object
and ignore whatever dummy object was created by @@create. Correct?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss