From: "hsbt (Hiroshi SHIBATA) via ruby-core" Date: 2026-03-24T05:27:19+00:00 Subject: [ruby-core:125111] [Ruby Bug#21819] A Data object should be frozen even if it has no members Issue #21819 has been updated by hsbt (Hiroshi SHIBATA). Backport changed from 3.2: REQUIRED, 3.3: REQUIRED, 3.4: DONE, 4.0: DONE to 3.2: REQUIRED, 3.3: DONE, 3.4: DONE, 4.0: DONE ruby_3_3 commit:f97da5bee650192897399eff2f372e46170ce72a merged revision(s) commit:d7a6ff8224519005d2deeb3f4e98689a8a0835ad. ---------------------------------------- Bug #21819: A Data object should be frozen even if it has no members https://bugs.ruby-lang.org/issues/21819#change-116825 * Author: dazuma (Daniel Azuma) * Status: Closed * ruby -v: ruby 4.0.0 (2025-12-25 revision 553f1675f3) +PRISM [arm64-darwin25] * Backport: 3.2: REQUIRED, 3.3: DONE, 3.4: DONE, 4.0: DONE ---------------------------------------- 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/