[#86520] [Ruby trunk Bug#14681] `syswrite': stream closed in another thread (IOError) — samuel@...
Issue #14681 has been reported by ioquatix (Samuel Williams).
3 messages
2018/04/12
[#86755] [Ruby trunk Feature#14723] [WIP] sleepy GC — normalperson@...
Issue #14723 has been reported by normalperson (Eric Wong).
6 messages
2018/04/29
[ruby-core:86612] [Ruby trunk Bug#14699] Subtle behaviors with endless range
From:
mame@...
Date:
2018-04-19 15:40:41 UTC
List:
ruby-core #86612
Issue #14699 has been reported by mame (Yusuke Endoh).
----------------------------------------
Bug #14699: Subtle behaviors with endless range
https://bugs.ruby-lang.org/issues/14699
* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v:
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
Currently, some Range's methods behaves weirdly with endless range.
## Range#max
Range#max always returns nil. Is this okay, or is another result expected?
```
p (0..).max #=> nil
p (0..).max(3) #=> nil
p (0..).max {|a, b| a <=> b } #=> nil
```
Note that `(0..).min {|a, b| a <=> b }` gets stuck. I think Range#min and Range#max should behave the same if a block are passed, but I'm uncertain what behavior is preferable.
## Range#last
Range#last returns nil if no argument is passed. But it gets stuck if a length argument is passed. Is this okay?
```
p (0..).last #=> nil
p (0..).last(3) #=> stuck
```
## Range#size
Range#size returns nil for endless range. I think this is somewhat reasonable because `("a".."z").size` returns 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>