Project

General

Profile

Actions

Feature #17397

closed

`shareable_constant_value: literal` should check at runtime, not at parse time

Added by marcandre (Marc-Andre Lafortune) over 3 years ago. Updated over 3 years ago.

Status:
Closed
Target version:
-
[ruby-core:101472]

Description

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:

# 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?


Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #17273: shareable_constant_value pragmaClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0