Issue #15747 has been updated by wanabe (_ wanabe).

Status changed from Feedback to Rejected

Now, I think this proposal doesn't make sense.
So I reject it. thank you.

----------------------------------------
Feature #15747: `(..1).last(2)` should return array but raise TypeError
https://bugs.ruby-lang.org/issues/15747#change-81915

* Author: wanabe (_ wanabe)
* Status: Rejected
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
`Range#last` with argument for beginless range shouldn't raise exception, should it?

```
$ ./miniruby -ve 'p (..1).last(2)'
ruby 2.7.0dev (2019-04-04 trunk 67430) [x86_64-linux]
Traceback (most recent call last):
	4: from -e:1:in `<main>'
	3: from -e:1:in `last'
	2: from -e:1:in `to_a'
	1: from -e:1:in `to_a'
-e:1:in `each': can't iterate from NilClass (TypeError)
```

`Range#last` without argument works fine.

```
$ ./miniruby -ve 'p (..1).last'
ruby 2.7.0dev (2019-04-04 trunk 67430) [x86_64-linux]
1
```



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