[#118415] [Ruby master Bug#20601] Configuration flags are not properly propagated to assembler — "vo.x (Vit Ondruch) via ruby-core" <ruby-core@...>

Issue #20601 has been reported by vo.x (Vit Ondruch).

7 messages 2024/07/02

[#118467] [Ruby master Feature#20610] Float::INFINITY as IO.select timeout argument — "akr (Akira Tanaka) via ruby-core" <ruby-core@...>

Issue #20610 has been reported by akr (Akira Tanaka).

8 messages 2024/07/07

[#118483] [Ruby master Bug#20614] Integer#size returns incorrect values on 64-bit Windows — surusek via ruby-core <ruby-core@...>

SXNzdWUgIzIwNjE0IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IHN1cnVzZWsgKMWBdWthc3ogU3VyKS4N

10 messages 2024/07/08

[#118577] [Ruby master Bug#20631] Build failure with Xcode 16 beta and macOS 15 (Sequoia) Beta — "hsbt (Hiroshi SHIBATA) via ruby-core" <ruby-core@...>

Issue #20631 has been reported by hsbt (Hiroshi SHIBATA).

9 messages 2024/07/12

[#118682] [Ruby master Misc#20652] Memory allocation for gsub has increased from Ruby 2.7 to 3.3 — "orisano (Nao Yonashiro) via ruby-core" <ruby-core@...>

Issue #20652 has been reported by orisano (Nao Yonashiro).

28 messages 2024/07/25

[ruby-core:118590] [Ruby master Feature#17279] Allow a negative step in Range#step with a block

From: "zverok (Victor Shepelev) via ruby-core" <ruby-core@...>
Date: 2024-07-14 11:33:33 UTC
List: ruby-core #118590
Issue #17279 has been updated by zverok (Victor Shepelev).


FWIW, my PR with adjusting `Range#step` behavior fixes this, too: https://github.com/ruby/ruby/pull/7444 (as part of the unificatioin/simplification process):

>>From the PR description:

> Consistent support for negative step:

```ruby
p (1..-10).step(-3).to_a 
#=> [1, -2, -5, -8] -- ArithmeticSequence backward iteration, on Ruby 3.3 and my code
(1..-10).step(-3) { p _1 }
# Ruby 3.3: step can't be negative (ArgumentError) -- inconsistent with ArithmeticSequence behavior
# my code: prints 1, -2, -5, -8, consistent with ArithmeticSequence
```

----------------------------------------
Feature #17279: Allow a negative step in Range#step with a block
https://bugs.ruby-lang.org/issues/17279#change-109117

* Author: mrkn (Kenta Murata)
* Status: Assigned
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
`Range#step` prohibits a negative step when a block is given.

```
>> (6..3).step(-1) {|i| p i }
Traceback (most recent call last):
        5: from /home/mrkn/.rbenv/versions/2.7/bin/irb:23:in `<main>'
        4: from /home/mrkn/.rbenv/versions/2.7/bin/irb:23:in `load'
        3: from /home/mrkn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/irb-1.2.4/exe/irb:11:in `<top (required)>'
        2: from (irb):1
        1: from (irb):1:in `step'
ArgumentError (step can't be negative)
```

But `Range#step` allows a negative step when it is called without a block.  In this case, `Range#step` creates an ArithmeticSequence, and `ArithmeticSequence#each` can iterate with a negative step.

```
>> (6..3).step(-1).each {|i| p i }
6
5
4
3
=> ((6..3).step(-1))
```

I think the prohibition of a negative step in `Range#step` has already been meaningless, so it may be better to permit it for consistency.



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- [email protected]
 To unsubscribe send an email to [email protected]
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/


In This Thread

Prev Next