From: marcandre-ruby-core@... Date: 2020-12-18T21:10:02+00:00 Subject: [ruby-core:101523] [Ruby master Feature#17397] `shareable_constant_value: literal` should check at runtime, not at parse time Issue #17397 has been updated by marcandre (Marc-Andre Lafortune). Great, thank you for the update. One last concern with `experimental_everything`/`experimental_shareable` is for Ruby 3.1... If no longer experimental, we then accept `everything`. But if someone want to write code also compatible with Ruby 3.0, they still have to use `experimental_everything` (assuming Ruby 3.1 also allow it). And in Ruby 3.2 same thing. Only in ~3 years can people start writing `everything` (assuming they want to be compatible with non-EOL rubies). Could be use `everything` (or my favorite: `all`) and either warn (once) that it is experimental, or document it? ---------------------------------------- Feature #17397: `shareable_constant_value: literal` should check at runtime, not at parse time https://bugs.ruby-lang.org/issues/17397#change-89308 * Author: marcandre (Marc-Andre Lafortune) * Status: Open * Priority: Normal * Assignee: ko1 (Koichi Sasada) ---------------------------------------- I think `shareable_constant_value: literal` is too strict because it has too crude checks at parse time. I wish the following code would parse and run: ```ruby # shareable_constant_value: literal class Foo < RuntimeError end # Similar code, but does not parse: Bar = Class.new(RuntimeError) # => unshareable expression Baz = Ractor.make_shareable(anything_here) # => unshareable expression Qux = Set[1, 2, 3].freeze # => unshareable expression ``` Could we instead raise some sort of RuntimeError when an assignment is made that is not shareable? -- https://bugs.ruby-lang.org/ Unsubscribe: