Actions
Bug #21819
openA Data object should be frozen even if it has no members
Bug #21819:
A Data object should be frozen even if it has no members
Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 4.0.0 (2025-12-25 revision 553f1675f3) +PRISM [arm64-darwin25]
Description
Data objects with at least one member are currently automatically frozen on construction, and shareable if all members are shareable. However, a Data object with no members is not frozen on construction. I would expect such an object similarly to be frozen (and also shareable since it has no non-shareable members).
Foo = Data.define(:foo)
Foo.new(1).frozen? # => true
Bar = Data.define
Bar.new.frozen? # => false
Updated by nobu (Nobuyoshi Nakada) 38 minutes ago
- Backport changed from 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN to 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED, 4.0: REQUIRED
Updated by nobu (Nobuyoshi Nakada) 29 minutes ago
Actions