- From: Mark S. Miller <erights@google.com>
- Date: Thu, 20 Jun 2013 13:00:21 -0700
- To: "Tab Atkins Jr." <jackalmage@gmail.com>
- Cc: "public-script-coord@w3.org" <public-script-coord@w3.org>
Received on Thursday, 20 June 2013 20:00:49 UTC
Agreed. Since posting I have liked this even less. I withdraw the suggestion. On Thu, Jun 20, 2013 at 12:38 PM, Tab Atkins Jr. <jackalmage@gmail.com>wrote: > On Thu, Jun 20, 2013 at 11:22 AM, Mark S. Miller <erights@google.com> > wrote: > > Not sure I like this: > > > > What about invoking the constructor function as a function, i.e., without > > the "new". If it cannot create the object synchronously, then it can't > > return the object synchronously, so there really is no constructor > function > > per se. So the name may as well just name a factory function which is > just > > called normally. > > Yeah, I don't like this either. I think it violates Least Surprise - > when the new-less constructor function works, it usually just still > returns a new object in practice. (I do this sometimes when I'm gonna > use a constructor a *ton* - just start the function with "if(!(this > instanceof MyClass)) return new MyClass(arg1, arg2);".) > > ~TJ > -- Cheers, --MarkM
Received on Thursday, 20 June 2013 20:00:49 UTC