From: "luke-gru (Luke Gruber) via ruby-core" Date: 2024-09-10T13:49:47+00:00 Subject: [ruby-core:119113] [Ruby master Bug#20472] Ractor support for ** into hash literal Issue #20472 has been updated by luke-gru (Luke Gruber). I've created a patch here: https://github.com/luke-gru/ruby/commit/5c3b7aacf23eaa9f6b1d2a2b5e2028d703dc190a Let me know if this is a good fix or not, as it currently allows things like this: ```ruby # shareable_constant_value: literal b = Object.new a = {"foo" => b} C = {**a} p C p C.frozen? # => true p C['foo'].frozen? # => true p b.frozen? # => true ``` This behavior is probably not what's expected when shareable_constant_value is literal because ``**a` isn't a literal. However, other non-literals are also supported right now such as variable accesses. I could fix this issue but it would take a bit of work. ---------------------------------------- Bug #20472: Ractor support for ** into hash literal https://bugs.ruby-lang.org/issues/20472#change-109706 * Author: kddnewton (Kevin Newton) * Status: Open * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- ```ruby # shareable_constant_value: experimental_copy a = { "foo" => "bar" } A = { **a } ``` In this example, Ruby fails an assertion and crashes. I think we should either provide support for this, or we should explicitly provide a syntax error indicating that ** isn't allowed in constant writes when ractor pragmas are enabled. -- 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/lists/ruby-core.ml.ruby-lang.org/