From: "Eustaquio Rangel de Oliveira Jr." Date: 2005-01-11T00:50:32+09:00 Subject: Re: Immediate values -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi! | "[I]mmediate values are not pointers: Fixnum, Symbol, true, false, and nil | are stored directly in VALUE. Fixnum values are stored as 31-bit numbers[Or | 63-bit on wider CPU architectures.] that are formed by shifting the | original number left 1 bit and then setting the least significant bit (bit | 0) to ``1.'' When VALUE is used as a pointer to a specific Ruby structure, | it is guaranteed always to have an LSB of zero; the other immediate values | also have LSBs of zero. Thus, a simple bit test can tell you whether or not | you have a Fixnum." Forgive me if I misunderstood, but so VALUEs are variables? a = 1 a is the VALUE, with 32 bit length? So, to find the object_id of *all* the Fixnum, all I have to do is something like: [taq@~]irb irb(main):001:0> i = 3 => 3 irb(main):002:0> s = "0b" << i.to_s(2) << "1" => "0b111" irb(main):003:0> s.to_i(2) => 7 The object_id of 3 always will be 7 right? But i does not point to somewhere on memory there? i is the own object? And when I have a bit 1 there on LSB is *always* a Fixnum? | Naturally, it ignores immutable objects. You can create millions of Fixnum | objects, yet they take no storage. Not so for String or Bignum objects: Ok, but how it does that? I mean, I have 31 (32?) bit numbers there on my one thousand vars on the local scope. Where they are stored? They are somewhere on the memory, right? How it can take no storage? Automatically killed after it scopes ends? But before this, where they are? :-) Sorry if I'm asking a lot about that, but immediate values made me curious about it. :-) Regards, - ---------------------------- Eust�quio "TaQ" Rangel eustaquiorangel@yahoo.com http://beam.to/taq Usu�rio GNU/Linux no. 224050 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFB4qQkb6UiZnhJiLsRAvBsAJ9NdntqBt0ZoPKAyrfnpr2J8aQRJwCfS4DX KO3f8rtIznKnp5pICtOc/+U= =vBrT -----END PGP SIGNATURE-----