unsubscribe
# Brian Corrigan (9 years ago)
Unsubscribe
Brian Corrigan Managing Partner / Principal Engineer at MadGlory www.linkedin.com/company/2657284
Wb: madglory.com, www.madglory.com
Tw: @madglory Ph: 518.867.1439
Unsubscribe --- Brian Corrigan Managing Partner / Principal Engineer at MadGlory <https://www.linkedin.com/company/2657284> Wb: http://madglory.com <http://www.madglory.com> Tw: @madglory Ph: 518.867.1439 On Sun, Jun 7, 2015 at 8:00 AM, <es-discuss-request at mozilla.org> wrote: > Send es-discuss mailing list submissions to > es-discuss at mozilla.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.mozilla.org/listinfo/es-discuss > or, via email, send a message with subject or body 'help' to > es-discuss-request at mozilla.org > > You can reach the person managing the list at > es-discuss-owner at mozilla.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of es-discuss digest..." > > Today's Topics: > > 1. Re: Reflect.type (Thaddee Tyl) > 2. Re: Reflect.type (Jordan Harband) > > > ---------- Forwarded message ---------- > From: Thaddee Tyl <thaddee.tyl at gmail.com> > To: Alexander Jones <alex at weej.com> > Cc: "es-discuss at mozilla.org" <es-discuss at mozilla.org> > Date: Sat, 6 Jun 2015 15:32:46 +0200 > Subject: Re: Reflect.type > You suggest a list of types of fixed size. The lack of exposition of > user-definable value types is a problem you mention. > > Having a better typeof is not as useful as having a better instanceof. > > This would be more valuable: > > ```js > isA(42, Number) === true // Doesn't work with instanceof > isA([1,3], Array) === true // Does work with instanceof > isA({one:1}, Object) === true // The distinction between array and > object was always weird with typeof > class Thing {} > isA(new Thing, Thing) === true > class SubThing {} > isA(new SubThing, Thing) === true // Detects subclassing / prototype > chain (which instanceof does not do) > ``` > > JS needs Ruby's is_a?. > > > > ---------- Forwarded message ---------- > From: Jordan Harband <ljharb at gmail.com> > To: Thaddee Tyl <thaddee.tyl at gmail.com> > Cc: "es-discuss at mozilla.org" <es-discuss at mozilla.org> > Date: Sat, 6 Jun 2015 09:23:26 -0700 > Subject: Re: Reflect.type > How would your `isA` work across realms, taking a built-in constructor? > `[1,2] instanceof Array` does not, which is why `Array.isArray` exists. > `Object(42) instanceof Number` would have the same problem. > > if `class SubThing extends Thing {}`, then `new SubThing instanceof Thing` > would be true. > > Based on your isA examples, `Object(foo) instanceof bar` should be > reliable within a single realm, and works everywhere, without the need for > a new builtin method. > > On Sat, Jun 6, 2015 at 6:32 AM, Thaddee Tyl <thaddee.tyl at gmail.com> wrote: > >> You suggest a list of types of fixed size. The lack of exposition of >> user-definable value types is a problem you mention. >> >> Having a better typeof is not as useful as having a better instanceof. >> >> This would be more valuable: >> >> ```js >> isA(42, Number) === true // Doesn't work with instanceof >> isA([1,3], Array) === true // Does work with instanceof >> isA({one:1}, Object) === true // The distinction between array and >> object was always weird with typeof >> class Thing {} >> isA(new Thing, Thing) === true >> class SubThing {} >> isA(new SubThing, Thing) === true // Detects subclassing / prototype >> chain (which instanceof does not do) >> ``` >> >> JS needs Ruby's is_a?. >> _______________________________________________ >> es-discuss mailing list >> es-discuss at mozilla.org >> https://mail.mozilla.org/listinfo/es-discuss >> > > > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150608/b82fb3d0/attachment.html>
~Chris cmarrin at apple.com