From: "k0kubun (Takashi Kokubun) via ruby-core" Date: 2026-01-13T01:13:08+00:00 Subject: [ruby-core:124492] [Ruby Bug#21819] A Data object should be frozen even if it has no members Issue #21819 has been updated by k0kubun (Takashi Kokubun). Backport changed from 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED, 4.0: REQUIRED to 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED, 4.0: DONE ruby_4_0 commit:6273c59a6e1f8587e549d5a5f44fd9363e6eb018 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-116044 * 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: REQUIRED, 3.4: REQUIRED, 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/