[#97063] [Ruby master Bug#16608] ConditionVariable#wait should return false when timeout exceeded — shugo@...

Issue #16608 has been reported by shugo (Shugo Maeda).

10 messages 2020/02/05

[#97084] [Ruby master Feature#16614] New method cache mechanism for Guild — ko1@...

Issue #16614 has been reported by ko1 (Koichi Sasada).

18 messages 2020/02/07

[#97248] [Ruby master Bug#16651] Extensions Do Not Compile on Mingw64 — cfis@...

Issue #16651 has been reported by cfis (Charlie Savage).

17 messages 2020/02/24

[#97289] [Ruby master Bug#16658] `method__cache__clear` DTrace hook was dropped without replacement — v.ondruch@...

Issue #16658 has been reported by vo.x (Vit Ondruch).

9 messages 2020/02/27

[#97307] [Ruby master Feature#16663] Add block or filtered forms of Kernel#caller to allow early bail-out — headius@...

Issue #16663 has been reported by headius (Charles Nutter).

29 messages 2020/02/28

[#97310] [Ruby master Feature#16665] Add an Array#except_index method — alexandr1golubenko@...

Issue #16665 has been reported by alex_golubenko (Alex Golubenko).

12 messages 2020/02/29

[ruby-core:97077] [Ruby master Feature#12624] !== (other)

From: jonathan@...
Date: 2020-02-06 20:00:40 UTC
List: ruby-core #97077
Issue #12624 has been updated by jonathanhefner (Jonathan Hefner).


Recently, I had a use case for this.  I was writing an assertion helper method which accepts a comparison operator (e.g. `:==`, `:!=`, `:===`, etc) to `send` to the expected value.  For my use case, having `!==` would be nice for a few reasons:

* Can express "assert not expected === actual" without the need for a "refute" method
* If defining a "refute" method, can implement it in terms of "assert" using operator inversion lookup table, i.e. `{ :== => :!=, :=== => :!==, :< => :>=, ... }`
* Error messages can be expressed without special casing, i.e. `"Expected: #{expected.inspect} #{op} #{actual.inspect}"`


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

* Author: eike.rb (Eike Dierks)
* Status: Rejected
* Priority: Normal
----------------------------------------
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>

In This Thread

Prev Next