Email missed the list. -----
Isiah Meadows [email protected] Looking for web consulting? Or a new website? Send me an email and we can get started. www.isiahmeadows.com ---------- Forwarded message ---------- From: Isiah Meadows <[email protected]> Date: Fri, Apr 20, 2018 at 12:47 PM Subject: Re: Proposal: allow primitives to be explicitly returned from constructors To: Sathya Gunasekaran <[email protected]> So I guess this has *no* chance of making it, then... :-( On Fri, Apr 20, 2018, 12:18 Sathya Gunasekaran <[email protected]> wrote: > > On Thu, Apr 19, 2018 at 3:49 PM, Isiah Meadows <[email protected]> wrote: > > Here's my proposal: > > > > In constructors, currently, non-objects are replaced with `this`. > > Here's what I think it should be replaced with: > > > > 1. When calling the constructor, if `undefined` is returned and > > `new.target` is not `undefined`, return `this` instead. This is for > > compatibility and ease of implementation. > > 1. When calling the constructor, if anything else is returned, return > > that value in raw form. > > > > I know this is very *likely* very breaking, but I wonder if it would > > be possible. > > I measured the usage of a non undefined return value, just for derived > class constructors in V8 > to see if this was possible: > https://github.com/tc39/ecma262/pull/469 > > But even that was not web compatible: > https://www.chromestatus.com/metrics/feature/timeline/popularity/2054 > > > In case you're curious what this would change in the spec, it would > > change [section 9.2.2][1], step 13.a-13.c to this: > > > > a. If result.[[Value]] is not `undefined`, return > > NormalCompletion(`result.[[Value]]`). > > b. If kind is `"base"`, return NormalCompletion(thisArgument). > > > > [1]: > > https://tc39.github.io/ecma262/#sec-ecmascript-function-objects-construct-argumentslist-newtarget > > > > ----- > > > > Isiah Meadows > > [email protected] > > > > Looking for web consulting? Or a new website? > > Send me an email and we can get started. > > www.isiahmeadows.com > > _______________________________________________ > > es-discuss mailing list > > [email protected] > > https://mail.mozilla.org/listinfo/es-discuss _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

