Issue #17397 has been updated by nobu (Nobuyoshi Nakada).


https://github.com/ruby/ruby/pull/3950

----------------------------------------
Feature #17397: `shareable_constant_value: literal` should check at runtime, not at parse time
https://bugs.ruby-lang.org/issues/17397#change-89343

* 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: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>