Forum: Ruby Fixnum: freeze status on ruby 2.0.0 rc2

Posted by Enrico Rivarola (henryrb)
on 2013-02-20 15:59
Hi,
I'm trying the last version of ruby (2.0 rc2) and I have an unexpected
behavior into a project. During test with rspec an error appair and I
would understand if the problem is caused by my code or a different
behavior of ruby 2.0.
The problem is about Fixnum object: in the ruby 1.9.3 a new created
Fixnum object is not freeze but in ruby 2.0 rc2 seem to be freeze.
prove it is simple, open irb, create a fixnum object (eg. n=12345) and
call frozen? method, here are the results (I'm using rvm to manage
rubies):
ruby 1.9.3 (ruby 1.9.3p385 (2013-02-06 revision 39114) [x86_64-linux])
1.9.3-p385 :001 > n=12345
 => 12345
1.9.3-p385 :002 > n.class
 => Fixnum
1.9.3-p385 :003 > n.frozen?
 => false
1.9.3-p385 :004 >

ruby 2.0 rc2 (ruby 2.0.0dev (2013-02-08 trunk 39161) [x86_64-linux])
2.0.0dev :001 > n=12345
 => 12345
2.0.0dev :002 > n.class
 => Fixnum
2.0.0dev :003 > n.frozen?
 => true
2.0.0dev :004 >

can anyone clarify this?

Enrico
Posted by Ryan Davis (Guest)
on 2013-02-20 18:37
(Received via mailing list)
Begin forwarded message:
Posted by Marc-Andre Lafortune (Guest)
on 2013-02-20 19:15
(Received via mailing list)
Indeed, Fixnums (and Bignums) are now frozen in 2.0.0, see
http://bugs.ruby-lang.org/issues/3222

I added that to the incompatibility list in the NEWS (r39340).
Posted by Bartosz Dziewoński (matmarex)
on 2013-02-20 19:25
(Received via mailing list)
It makes sense. A Fixnum is immutable, so it can be considered "frozen".

There is an entry for this in the Ruby changelog: 
https://github.com/ruby/ruby/blob/trunk/ChangeLog#L8266
Posted by Ryan Davis (Guest)
on 2013-02-20 20:14
(Received via mailing list)
On Feb 20, 2013, at 10:24 , Bartosz Dziewoński <matma.rex@gmail.com> 
wrote:

> It makes sense. A Fixnum is immutable, so it can be considered "frozen".
>
> There is an entry for this in the Ruby changelog: 
https://github.com/ruby/ruby/blob/trunk/ChangeLog#L8266

https://github.com/ruby/ruby/commit/f3e5f2cd758f50...
Posted by Enrico Rivarola (henryrb)
on 2013-02-20 20:28
Many thanks to all,
I had lost these news for ruby 2.0
Posted by SASADA Koichi (Guest)
on 2013-02-20 20:57
(Received via mailing list)
(2013/02/21 3:13), Marc-Andre Lafortune wrote:
> I added that to the incompatibility list in the NEWS (r39340).

Thank you. I forgot to add NEWS...
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.