new instantiation design alternatives
waldron.rick at gmail.com
Mon Sep 15 12:22:37 PDT 2014
On Mon, Sep 15, 2014 at 2:57 PM, Brendan Eich <brendan at mozilla.org> wrote:
> Rick Waldron wrote:
>> The first is also objectionable because it breaks existing implicit
>> return semantics.
> Say what? Constructors can return a different object from `this`, that's
> just JS.
Yikes, I should've been more specific. Generally, it's considered an
anti-pattern to write constructors that explicitly return an object to
override `this`(for all the reasons you'd expect)—that's not to say that it
isn't done or doesn't exist (and certainly I didn't mean to imply that it
wasn't possible). Design that might rely on that pattern would conflict
with widely accepted best practices.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss