IsConstructor
Allen Wirfs-Brock
allen at wirfs-brock.com
Mon Jun 16 09:47:49 PDT 2014
On Jun 15, 2014, at 11:45 PM, Tom Van Cutsem wrote:
> 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 other.
>
> Smalltalk has both extension points (#new and #initialize). I think JS programmers could handle this just as well.
and #basicNew. It seeded to me that many Smalltalk programmer were unclear about when to over-ride #new vs when to over-ride #basicNew.
>
> 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?
right.
Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140616/69db553d/attachment.html>
More information about the es-discuss
mailing list