[#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:116018] [Ruby master Feature#15927] Allow string keys to be used for String#% and sprintf methods
From:
"luke-gru (Luke Gruber) via ruby-core" <ruby-core@...>
Date:
2024-01-04 22:26:31 UTC
List:
ruby-core #116018
Issue #15927 has been updated by luke-gru (Luke Gruber).
This can be closed as I agree with the feedback given. Thanks!
----------------------------------------
Feature #15927: Allow string keys to be used for String#% and sprintf methods
https://bugs.ruby-lang.org/issues/15927#change-106008
* Author: luke-gru (Luke Gruber)
* Status: Open
* Priority: Normal
----------------------------------------
Right now, in the methods sprintf() and String#%, only symbol keys can be used for named interpolation. For example (from the example documentation):
"foo = %{foo}" % { :foo => 'bar' } #=> "foo = bar"
String keys do not work like this:
"foo = %{foo}" % { 'foo' => 'bar' } #=> raises KeyError
I think string keys should work just the same as symbol keys here.
I've created a PR on github for this, perhaps misguidedly, but if can be found here: https://github.com/ruby/ruby/pull/2238
My argument for this feature is that String#gsub() and family works with string keys if given a Hash, for example:
"chocolate ice cream".gsub(/\bc/, { 'c' => 'C' }) #=> 'Chocolate ice Cream'
Also, I don't like having to symbolize keys in strings unnecessarily, but maybe that just goes back to when
Ruby couldn't GC some symbols.
--
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/