[#88925] [Ruby trunk Feature#15095] [PATCH] share VM stack between threads and fibers if identical — ko1@...
Issue #15095 has been updated by ko1 (Koichi Sasada).
4 messages
2018/09/09
[#88927] Re: [Ruby trunk Feature#15095] [PATCH] share VM stack between threads and fibers if identical
— Eric Wong <normalperson@...>
2018/09/09
[email protected] wrote:
[#88926] [Ruby trunk Feature#15095] [PATCH] share VM stack between threads and fibers if identical — ko1@...
Issue #15095 has been updated by ko1 (Koichi Sasada).
3 messages
2018/09/09
[#89218] [Ruby trunk Bug#15130] open-uri hangs on cygwin — duerst@...
SXNzdWUgIzE1MTMwIGhhcyBiZWVuIHVwZGF0ZWQgYnkgZHVlcnN0IChNYXJ0aW4gRMO8cnN0KS4K
5 messages
2018/09/30
[ruby-core:88922] [Ruby trunk Feature#15092] Provide step count in Range constructor
From:
ruby-core@...
Date:
2018-09-09 13:57:43 UTC
List:
ruby-core #88922
Issue #15092 has been updated by marcandre (Marc-Andre Lafortune). v0dro (Sameer Deshmukh) wrote: > Advantages of changing the constructor: > * Makes it easy to read test code for someone new to Ruby. Very debatable. > * Consistency in specifying step count in constructor (simple and straightforward way) and using > the shorter syntax (idiomatic Ruby way). It's actually not consistent, since the result is a `Enumerator::ArithmeticSequence`, not a `Range`. > Disadvantages: > * Few extra lines of code to change the constructor. I realize you wrote "introduces a step property in Ranges anyway I think this will be a useful addition", but this is not true. `Range` will not have a `step` property. It's simply that the `step` method will now return a different class of object that is more useful. ---------------------------------------- Feature #15092: Provide step count in Range constructor https://bugs.ruby-lang.org/issues/15092#change-73958 * Author: v0dro (Sameer Deshmukh) * Status: Feedback * Priority: Normal * Assignee: * Target version: ---------------------------------------- I would like to propose making changes to the Range constructor so that a user can specify a `step` count along with `start` and `stop`. Since Ruby 2.6 will introduce a `step` property in Ranges anyway I think this will be a useful addition. Here's my reasons for the changes: When creating software libraries for numerical computing, it is common to query the data container for values in a particular range at some given steps. For example, say I have the following NArray object: ~~~ ruby a = NArray.new([1,2,3,4,5,6,7,8,9,10,11,12]) ~~~ And I want the values `1`, `4`, `7`, `10` and `12`, I can simply specify a Range like this: ~~~ ruby r = Range.new 0, Float::INFINITY, 3 # start, stop (upto the end), step a[r] # => NArray([1, 4, 7, 10, 12]) ~~~ This can possibly also be extended to `Array#[]` so that users can get ranges of values at steps without much worry. -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>