[#116016] [Ruby master Bug#20150] Memory leak in grapheme clusters — "peterzhu2118 (Peter Zhu) via ruby-core" <ruby-core@...>
Issue #20150 has been reported by peterzhu2118 (Peter Zhu).
7 messages
2024/01/04
[#116382] [Ruby master Feature#20205] Enable `frozen_string_literal` by default — "byroot (Jean Boussier) via ruby-core" <ruby-core@...>
Issue #20205 has been reported by byroot (Jean Boussier).
77 messages
2024/01/23
[ruby-core:116438] [Ruby master Feature#20211] Reconsider introducing 3.2-style support of Anonymous Args/Blocks
From:
"johnnyshields (Johnny Shields) via ruby-core" <ruby-core@...>
Date:
2024-01-25 05:00:14 UTC
List:
ruby-core #116438
Issue #20211 has been reported by johnnyshields (Johnny Shields).
----------------------------------------
Feature #20211: Reconsider introducing 3.2-style support of Anonymous Args/Blocks
https://bugs.ruby-lang.org/issues/20211
* Author: johnnyshields (Johnny Shields)
* Status: Open
* Priority: Normal
----------------------------------------
(My sincere apologies if this issue has already been raised, I didn't see it in Ruby 3.4 backlog.)
As per https://bugs.ruby-lang.org/issues/19370, Ruby 3.3 no longer allows the following:
```ruby
def m(*)
[1, 2, 3].each { |*| p(*) }
end
m('test', 'test', 'test')
#=> Ruby 3.2: p(*) uses args from m(*) #=> test, test, test
#=> Ruby 3.3: raises SyntaxError: anonymous rest parameter is also used within block
```
I am concerned because Rubocop auto-corrects Ruby 3.1+ code to syntax which is no longer supported in Ruby 3.3. There may be quite a bit of Ruby code in the wild which breaks on 3.3 (my own app broke in about 50 places).
- [Ruby 3.1+: Naming/BlockForwarding (default true)](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Naming/BlockForwarding)
- [Ruby 3.2+: Style/ArgumentsForwarding with UseAnonymousForwarding (default true)](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/ArgumentsForwarding)
It would be nice if the Ruby 3.4 syntax could allow the old nested syntax, supporting arg shadowing with different behavior between implicit and explicit |*| usage.
```ruby
def m(*)
[1, 2, 3].each { p(*) }
end
m('test', 'test', 'test')
#=> Ruby 3.2: p(*) uses args from m(*) #=> test, test, test
#=> Ruby 3.4: p(*) uses args from m(*) #=> test, test, test
def m(*)
[1, 2, 3].each { |*| p(*) }
end
m('test', 'test', 'test')
#=> Ruby 3.2: p(*) uses args from m(*) #=> test, test, test
#=> Ruby 3.4: p(*) uses args from each #=> 1, 2, 3
```
The same would also apply to anonymous blocks.
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/