Issue #15745 has been updated by mame (Yusuke Endoh).


I think we digress.  I had no intention to discuss a beginless range itself, but maybe it started digressing.  My apologies.  Let's focus on the original topic in this ticket.

Do you think which is the best?

(0) Keep the current behavior: `p (1..) #=> (1..)`, `p (..1) #=> (nil..1)`, and `p (nil..nil) #=> (nil..)`.
(1) Make all cases explicit: `p (1..) #=> (1..nil)`, `p (..1) #=> (nil..1)`, and `p (nil..nil) #=> (nil..nil)`.
(2) Omit all `nil`s except `(nil..nil)`: `p (1..) #=> (1..)`, `p (..1) #=> (..1)`, and `p (nil..nil) #=> (nil..nil)`.

I have no strong opinion.  (Honestly, I'm not so interested in the result of `inspect` in this case.)  But if I have to choose, my current opinion is (0).

* (0) is somewhat reasonable for me.
* (1) looks a bit verbose to me (and brings tiny incompatibility).
* I don't like (2) because of the special handling.

Let me know your opinions.  I'll bring them to the next dev meeting and ask matz decide.

----------------------------------------
Bug #15745: There is no symmetry in the beginless range and the endless range using `Range#inspect`
https://bugs.ruby-lang.org/issues/15745#change-77860

* Author: koic (Koichi ITO)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.7.0dev (2019-04-03 trunk 67423) [x86_64-darwin17]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
The following commit introduces beginless range.
https://github.com/ruby/ruby/commit/95f7992b89efd35de6b28ac095c4d3477019c583

```
% ruby -v
ruby 2.7.0dev (2019-04-03 trunk 67423) [x86_64-darwin17]
```

There is no symmetry with endless range when using `Range#inspect` method.

```
(1..).inspect # => "1.."
(..5).inspect # => "nil..5"
```

How about unifying whether it represents `nil`?




-- 
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>