Re: WHO CAN HELP ME TO UNSUBSCRIBE THIS EMAIL

2018-04-20 Thread Michael Luder-Rosefield
Can anyone put together a strawman proposal for unsubscribing from this email? I suggest using `!@` as the operator. On Fri, 20 Apr 2018 at 04:59 Felipe Nascimento de Moura < felipenmo...@gmail.com> wrote: > well, access the link: > https://mail.mozilla.org/listinfo/es-discuss > > then look for

Re: WHO CAN HELP ME TO UNSUBSCRIBE THIS EMAIL

2018-04-20 Thread Isiah Meadows
An alternative way is to send an email to es-discuss-requ...@mozilla.org with "unsubscribe" in the subject or body. (You can also email it "help" to get info on other commands.) - Isiah Meadows m...@isiahmeadows.com Looking for web consulting? Or a new website? Send me an email and we can get

Re: Proposal: allow primitives to be explicitly returned from constructors

2018-04-20 Thread Oriol _
> You already can't assume the result is `typeof new function () { return value > } === "object"` Yes, that's why I need reliable ways to test whether a value is an object, and your proposal breaks one of these. > here's what I usually do: > > ``` > function isObject(value) { > return value

Re: Proposal: allow primitives to be explicitly returned from constructors

2018-04-20 Thread T.J. Crowder
On Fri, Apr 20, 2018 at 2:23 PM, Oriol _ wrote: > No, `typeof` is not reliable, because it's implementation-defined > for non-standard non-callable exotic objects. > > For example, old IE used to return `"unknown"` in various cases. Also `"object"` for host-provided functions (such as `document.c

Re: Proposal: allow primitives to be explicitly returned from constructors

2018-04-20 Thread Naveen Chawla
What's the use case? Maybe there's a nice way of doing what you want On Fri, 20 Apr 2018 at 19:17 T.J. Crowder wrote: > On Fri, Apr 20, 2018 at 2:23 PM, Oriol _ > wrote: > > No, `typeof` is not reliable, because it's implementation-defined > > for non-standard non-callable exotic objects. > > >

Re: Proposal: allow primitives to be explicitly returned from constructors

2018-04-20 Thread Isiah Meadows
I normally name it `isReferenceType` or similar, but was just reusing the name originally used here. For the purposes of this, my `isReferenceType` is equivalent to the `value === new function () { return value }` check, while still avoiding diving into builtins. I was just focused on a correct equ

Re: Proposal: allow primitives to be explicitly returned from constructors

2018-04-20 Thread Isiah Meadows
Okay, you could invert the condition and do it this way. If it's spec-conforming, this should work: ```js function isObject(value) { return value != null && typeof value !== "boolean" && typeof value !== "number" && typeof value !== "string" && typeof value !==

Re: Proposal: allow primitives to be explicitly returned from constructors

2018-04-20 Thread Sultan
One of the use case for this is – given a function that is either one that returns an instance or one that returns an explicit return value, but would otherwise throw if invoked without the "new" keyword. Always being able to safely invoke it with "new" is a nice guarantee to have that wouldn't re

Re: Proposal: allow primitives to be explicitly returned from constructors

2018-04-20 Thread T.J. Crowder
On Thu, Apr 19, 2018 at 11:49 PM, Isiah Meadows 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 `undefine

Re: Proposal: allow primitives to be explicitly returned from constructors

2018-04-20 Thread Michael Theriot
I don't understand the use case. If anything I would like it if returning an object that fails `new Class instanceof Class` to also fail, not permit even more oddities. On Thu, Apr 19, 2018 at 6:49 PM, Isiah Meadows wrote: > Here's my proposal: > > In constructors, currently, non-objects are rep

Re: Proposal: allow primitives to be explicitly returned from constructors

2018-04-20 Thread Isiah Meadows
My rationale was detailed in a response to another person eariler: > But my idea was just to bring `new` and normal calls a little closer to one another. Eventually, I'd like to see if primitive wrapper types could disappear, and this is one of the areas where I'm trying to see if it's feasible to

Fwd: Proposal: allow primitives to be explicitly returned from constructors

2018-04-20 Thread Isiah Meadows
Email missed the list. - Isiah Meadows m...@isiahmeadows.com 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 Date: Fri, Apr 20, 2018 at 12:47 PM Subject: Re: Proposal: