Hi --

On Wed, 27 Nov 2002, William Djaja Tjokroaminata wrote:

> Jason Persampieri <helgaorg / yahoo.com> wrote:
> > OK... I get it... I understood your argument (although
> > ya cleared up a few other things), but I still just
> > didn't GET why you couldn't do a '++' method that
> > simply did something like 'self = self.succ'
>
> Hi Jason,
>
> Let me try to clear things up.  *Theoretically*, it is not impossible to
> be able to write in some non-standard Ruby
>
>     x = 5
>     y = 5
>     x.succ!    # -> x == 6, y == 5
>
> in which case x and y actually have different id's.  This can be
> accomplised if *all* objects/variables had simply been implemented as
> VALUE which is a pointer.  I think this is done in some other languages
> such as Tcl and Python.
>
> However, *practically* we cannot do it in the current Ruby C
> implementation, because [Fixnum, Symbol, true, false, nil] have been
> implemented as VALUE which is an immediate object.  (Each object
> is a "singleton" if you want to call it that way.)  I guess Matz created
> the "immediate objects" for efficiency reason, but this has the
> consequence of the impossibility to have x.succ! if x is a Fixnum.

I think there's a point at which it's OK to say that something is a
characteristic of Ruby, not just of the current Ruby implementation,
and this is probably it :-)


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav