Re: Strawman proposal: new `is` operator

2014-09-01 Thread Isiah Meadows
Here's my (more formalized) proposition. I also have added a proposed @@isInstance property for the `isa` equivalent for @@hasInstance. I know this was mostly put on hold initially because of my lack of proper formulation, but here it is. ### Rationale: ### Include an `isa` operator to

Re: Strawman proposal: new `is` operator

2014-08-26 Thread Till Schneidereit
On Tue, Aug 26, 2014 at 3:56 AM, Brendan Eich bren...@mozilla.org wrote: ES4 had 'is' as a type-classifying operator: http://wiki.ecmascript.org/doku.php?id=proposals:is_as_to http://wiki.ecmascript.org/doku.php?id=discussion:is_as_to It would be a mistake to define 'is' without defining

Re: Strawman proposal: new `is` operator

2014-08-26 Thread Isiah Meadows
I stand corrected on the creation aspect. Isiah Meadows On Aug 25, 2014 9:56 PM, Brendan Eich bren...@mozilla.org wrote: Isiah Meadows wrote: Cc the list... On Aug 25, 2014 6:06 PM, Isiah Meadows impinb...@gmail.com mailto: impinb...@gmail.com wrote: There really shouldn't be any

Re: Strawman proposal: new `is` operator

2014-08-25 Thread Florian Bösch
Python, Coffeescript and VB use the is operator for object identity, not for instanceof like functionality. Dart uses the is operator analogous to instanceof. It would seem to me it'd be beneficial to pick a different operator name, in order to avoid the fuddled meaning this operator has taken to

Re: Strawman proposal: new `is` operator

2014-08-25 Thread Andrea Giammarchi
I know it's just a sketch but that `Object.prototype.is` does not play well with `Object.create` where no constructor is necessary to create `is` relations. Regards On Sun, Aug 24, 2014 at 10:15 PM, C. Scott Ananian ecmascr...@cscott.net wrote: On Sun, Aug 24, 2014 at 4:04 PM, Isiah Meadows

Re: Strawman proposal: new `is` operator

2014-08-25 Thread Isiah Meadows
Cc the list... On Aug 25, 2014 6:06 PM, Isiah Meadows impinb...@gmail.com wrote: There really shouldn't be any sort of object construction needed to check types like this. `isa` may be better, anyways, but I still find that requirement to build and destroy an object to check somewhat

Re: Strawman proposal: new `is` operator

2014-08-25 Thread Brendan Eich
Isiah Meadows wrote: Cc the list... On Aug 25, 2014 6:06 PM, Isiah Meadows impinb...@gmail.com mailto:impinb...@gmail.com wrote: There really shouldn't be any sort of object construction needed to check types like this. `isa` may be better, anyways, but I still find that

Strawman proposal: new `is` operator

2014-08-24 Thread Isiah Meadows
There is no way currently to reliably verify types in JS. Type annotations cannot solve this completely, especially when you have an overloaded function. A way to reliably verify types would make this far easier. So far, here are the current options with their respective caveats: 1. `instanceof`

Re: Strawman proposal: new `is` operator

2014-08-24 Thread C. Scott Ananian
On Sun, Aug 24, 2014 at 4:04 PM, Isiah Meadows impinb...@gmail.com wrote: There is no way currently to reliably verify types in JS. Type annotations cannot solve this completely, especially when you have an overloaded function. A way to reliably verify types would make this far easier. So far,

Re: Strawman proposal: new `is` operator

2014-08-24 Thread Ian Hickson
On Sun, 24 Aug 2014, Isiah Meadows wrote: One big question I have is whether a different keyword should be used (`isa`, etc), given its use as a keyword synonym to `===` in many compile-to-JS languages, most notably CoffeeScript. is is used to mean is an instance of or an instance of a