Small Proposal "!in"

Mike Samuel mikesamuel at
Wed Jul 11 18:27:04 UTC 2018

On Wed, Jul 11, 2018 at 1:51 PM T.J. Crowder <
tj.crowder at> wrote:

> On Wed, Jul 11, 2018 at 4:51 PM, Alex Vincent <ajvincent at> wrote:
> > In Linux programming, #!/bin/bash is very commonly the first line of a
> shell
> > script. In Python, we have #!/bin/python, or #!/bin/perl.  The #!
> characters
> > are pronounced "she-bang", because # is pronounced "hash" and ! is
> > pronounced "bang".
> Indeed. But in JavaScript (and Java and C and C# and...), `!` is "not",
> and I for one read it that way when reading anything other than bash
> script. I don't read `!==` as "bang equal," either. (Which in British
> English would be really misleading...)
> And that's why I like the idea of `!in` (or `notin`), because I'd much
> rather read and write "if property not in object" than "if not property in
> object" (and don't get me started on the parens required to make it work
> :-) ).
> To me, `!in` or `notin` or whatever you want makes perfect sense, just
> like we have `!=` and `!==`. It's like not having `!==` and then arguing we
> don't need to have it because after all, you can write `n != 1` as `!(n ==
> 1)`.

> Heck, all we really need is NAND gates, right? ;-)

> On Wed, Jul 11, 2018 at 6:33 PM, Isiah Meadows <isiahmeadows at>
> wrote:
> > So I agree this is a Really Bad Idea™, for this above if not the Kotlin
> > reference.
> I strongly disagree it's a Really Bad Idea™. I think it's a Moderately
> Good Idea On The Whole™. And `!in` is fine by me but I'm also happy with
> `notin` or whatever.

I agree with all your arguments about why it's more ergonomic, but I keep
coming back to what Naveen said: "I don't use `in`."

I think `in` is the wrong operator to make more convenient, except as part
of a more general cleanup to provide inverted forms of boolean infix

Usually, where I see `in` I would prefer that the author had used
And usually where I see (foo.hasOwnProperty(p)), I would prefer the author
wrote Reflect.apply(hasOwnProperty, foo, [p]).

What are the use cases for `in` that would not be better served by an
ergonomic, infix hasOwnProperty?

I just don't expect it to happen. Too much inertia to add it
> after-the-fact, and too many bigger fish to fry. :-)

> -- T.J. Crowder
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list