From: "Mauricio Fernández" Date: 2004-06-26T02:55:54+09:00 Subject: Re: I am confused with Value Type Objects On Sat, Jun 26, 2004 at 02:38:05AM +0900, Sam Sungshik Kong wrote: > 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? In Ruby, Fixnums have 31 bits; the missing bit (least significant one) is used to mark it as a fixnum. This works because other objects will be at even addresses. > I'm from C# background. > In C# (actually dotnet framework), values types are structures not just a > simple value. Most objects in Ruby are indeed represented internally by structures; take a look at ruby.h. -- Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com We are using Linux daily to UP our productivity - so UP yours! -- Adapted from Pat Paulsen by Joe Sloan