Issue #15745 has been updated by zverok (Victor Shepelev).


> I think that an endless range will be much more commonly used than a beginless one because an endless range has many use cases but a beginless range has only one use case (DSL-like usage). Thus, I liked to make an endless one more useful and implemented the current behavior.
 
That's very confusing. 
The only thing where the beginless range is less justified than endless is **indexing of arrays**, which I believe is a very small share of Range usage.

Other are:
* case
* grep
* storing ranges in constants
* indeed DSLs (many kinds of them)
* clamp (if the [ticket](https://bugs.ruby-lang.org/issues/14784) would be accepted, which I believe it should)

Generally, the beginless range is an exactly equally powerful and useful concept as an endless one, and the thing that "for array indexing, the beginless range is less useful" should be considered a style detail, not the reason for deliberately "less mindful" implementation.

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

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