Project

General

Profile

Actions

Bug #21819

closed

A 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

Added by dazuma (Daniel Azuma) about 11 hours ago. Updated about 6 hours ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 4.0.0 (2025-12-25 revision 553f1675f3) +PRISM [arm64-darwin25]
[ruby-core:124417]

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) about 7 hours ago Actions #1

  • 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) about 6 hours ago Actions #3

  • Status changed from Open to Closed

Applied in changeset git|d7a6ff8224519005d2deeb3f4e98689a8a0835ad.


[Bug #21819] Data objects without members should also be frozen

Actions

Also available in: PDF Atom