Fixing the associativity / precedence of the instanceof operator
till at tillschneidereit.net
Tue Aug 26 05:08:30 PDT 2014
On Tue, Aug 26, 2014 at 5:48 AM, Charles Pick <charles at codemix.com> wrote:
> Ok, what if `!foo instanceof Foo` became a strict mode error instead?
That'd increase the difference between the two modes, which is something
nobody wants. Also, someone employing strict mode is also quite a bit more
likely to use developer tools such as linters. Those certainly should warn
about code like that.
On Tue, Aug 26, 2014 at 11:54 AM, Barronville, Jonathan <
jonathan at belairlabs.com> wrote:
> I’m on the same page as Charles. I feel like it should be okay to fix
> something like this … at least in strict mode.
Browser vendors would have to make the change, and users just switch
browsers if sites break. Users don't care about a change being for the
better on a conceptual level. Really, the only backwards-incompatible
changes we can introduce are in areas where either features were almost
entirely unused (very rare with a tail as long as the web's!) or engines
disagree so much as to make specific patterns impossible to use.
> Or introduce a tiny bit of new grammar supporting something like `foo !
> instanceof Foo` (or `foo not instanceof Foo`) maybe?
How would that help? You can already write perfectly correct code for this
with `!(foo instanceof Foo)`. Your proposal would add one more way of
expressing what you want, but it won't make the wrong way any more right.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss