From: "marcandre (Marc-Andre Lafortune)" Date: 2012-06-04T01:12:42+09:00 Subject: [ruby-core:45408] [ruby-trunk - Bug #6538] Mutability of Rational and Complex Issue #6538 has been updated by marcandre (Marc-Andre Lafortune). Hi, nobu (Nobuyoshi Nakada) wrote: > Marshal compatibilities for (({Complex})) and (({Rational})) are already broken, > since the time they were built in. I didn't know. Changing from `#marshal_load` to `.load` would break marshalling between 1.9 and 2.0 though. Unless marshal changes to handle both cases similarly? I mean, why are there two different codes for marshalling done via `#marshal_dump` vs `_dump`? It could be the same, if `._load` exists, it is called, otherwise the object is constructed and `#marshal_load` is called? tadf (tadayoshi funaba) wrote: > i doubt about this issue. > really need? I have doubts too, which is why I asked "Is this worth fixing?" ---------------------------------------- Bug #6538: Mutability of Rational and Complex https://bugs.ruby-lang.org/issues/6538#change-26998 Author: marcandre (Marc-Andre Lafortune) Status: Assigned Priority: Low Assignee: tadf (tadayoshi funaba) Category: core Target version: ruby -v: r35875 I hesitated to report this, but there is a "hole" in the immutability of Rational & Complex: r = Rational(0) # Rationals are immutable r.freeze # but let's be certain and freeze it! magic_trick(r) # r is now changed: r # => (1/42) The same thing occurs with Complex. I've left out the definition of `magic_trick` for anyone who wants to try and figure it out, but it's here: http://pastie.org/4016117 Is this worth fixing? -- http://bugs.ruby-lang.org/