Issue #6538 has been reported by marcandre (Marc-Andre Lafortune).

----------------------------------------
Bug #6538: Mutability of Rational and Complex
https://bugs.ruby-lang.org/issues/6538

Author: marcandre (Marc-Andre Lafortune)
Status: Open
Priority: Low
Assignee: 
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/