Issue #12624 has been updated by Robert A. Heiler.


I don't have any particular strong pro or con opinion here, but I should like to note that my bad eyes have it not so easy to distinguish between = == != =! !== ==!.

I actually think that !(String === mod) may be easier to read than (String !== mod) - the amount of characters saved is very negligible.

But it is just an opinion, as said, I have neither strong pro or con opinion on it really.

----------------------------------------
Feature #12624: !== (other)
https://bugs.ruby-lang.org/issues/12624#change-59813

* Author: Eike Dierks
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
I'd like to suggest a new syntactic feature.

There should be an operator `!==`
which should just return the negation of the `===` operator

### aka:

```ruby
def !==(other)
     ! (self === other)
end
```

### Rationale:
The `===` operator is well established.
The `!==` operator would just return the negated truth value of `===`
That syntax would mimick the duality of `==` vs `!=`

### Impact:
To my best knowledge, `!==` is currently rejected by the parser,
 so there should be no exsiting code be affected by this change.

### Do we really need that?
obviously `(! (a === b))` does the job,
while, `(a !== b)` looks a bit more terse to me.

### What's the use case?
I personally got a habit of using `===` in type checking arguments:

```ruby
raise TypeError() unless (SomeClass === arg)
```

You might argue that I should write instead:

```ruby
raise TypeError() unless arg.kind_of?(SomeClass)
```

(you are obviously right in that)

But the `===` operator is there for a reason,
and it is actually a strong point of ruby,
that we do not only have identity or equivalence,
but this third kind of object defined equality.

I believe, that in some cases
the intention of a boolean clause
would be easier to understand if we had that `!==` operator
instead of writing `!(a===b)`

I agree, syntax ahould not change.
But I believe that would add to the orthogonality.

---

Please see also:
my request on reserving the UTF operator plane for operators















 












-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>