Small Proposal "!in"

alexander at debenclipper.com alexander at debenclipper.com
Fri Jul 13 15:36:58 UTC 2018


This may be a silly idea that doesn't come naturally to others, but the 
first thing I thought of was "!n", where the "!" represents a flipped 
"i", so the inverse of in.

Although, on the discussion of "notin" or "!in", the latter comes far 
more naturally to me as others have mentioned.

On 2018-07-11 12:27, Mike Samuel wrote:
> On Wed, Jul 11, 2018 at 1:51 PM T.J. Crowder
> <tj.crowder at farsightsoftware.com> wrote:
> 
>> On Wed, Jul 11, 2018 at 4:51 PM, Alex Vincent <ajvincent at gmail.com>
>> 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 gmail.com> 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 operators.
> 
> Usually, where I see `in` I would prefer that the author had used
> hasOwnProperty.
> 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 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


More information about the es-discuss mailing list