From: "dazuma (Daniel Azuma) via ruby-core" Date: 2026-01-03T02:19:06+00:00 Subject: [ruby-core:124417] [Ruby Bug#21819] A Data object should be frozen even if it has no members Issue #21819 has been reported by dazuma (Daniel Azuma). ---------------------------------------- Bug #21819: A Data object should be frozen even if it has no members https://bugs.ruby-lang.org/issues/21819 * Author: dazuma (Daniel Azuma) * Status: Open * ruby -v: ruby 4.0.0 (2025-12-25 revision 553f1675f3) +PRISM [arm64-darwin25] * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- 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 ``` -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/