S
Sam Sungshik Kong
Hello!
In ruby, every object is reference type except for FixNum, NilClass,
TrueClass, FalseClass.
Let's consider FixNum only.
According to http://www.rubygarden.org/ruby?GCAndMemoryManagement, FixNum
takes only 4 bytes (on 32-bit machines).
Is it true?
If so, doesn't it have any other information except for the value itself?
How does ruby know that a FixNum is actually a FixNum instead of a reference
to an object when it doesn't have any information about the type?
I'm from C# background.
In C# (actually dotnet framework), values types are structures not just a
simple value.
Could somebody resolve my confusion?
Thanks.
Sam
In ruby, every object is reference type except for FixNum, NilClass,
TrueClass, FalseClass.
Let's consider FixNum only.
According to http://www.rubygarden.org/ruby?GCAndMemoryManagement, FixNum
takes only 4 bytes (on 32-bit machines).
Is it true?
If so, doesn't it have any other information except for the value itself?
How does ruby know that a FixNum is actually a FixNum instead of a reference
to an object when it doesn't have any information about the type?
I'm from C# background.
In C# (actually dotnet framework), values types are structures not just a
simple value.
Could somebody resolve my confusion?
Thanks.
Sam