Sat, 3 Aug 2002 22:04:18 +0900, Tom Sawyer <transami / transami.net> pisze:

> no, i think you take this too far. it makes a lot of sense in a
> language like ruby, but does require a seperation between assignment
> and reassignment, if you will. in other words x = "a" would not
> necessarily be the same as x = String.new("a"),

Well, in this sense it's already done: your reassignment is spelled
x.replace(y). But not all objects are mutable (and that's good)
and this variant is not used by default.

How would you store a reference to an object? Explicit pointers with
dereferencing?

> unfortuanltly a couple of ruby objects are not passed by reference,
> notably FIXNUM.

It doesn't matter. It behaves as if passed by reference, except a few
weird cases not relevant to our problem (like singleton methods).
If an object is immutable and we don't compare object identities, the
effect of passing it by reference and copying its value is the same.

> (aside, would it be possible for ! methods to be an automatic creation?
> just seems like there might be a way to define a method such that the !
> version of it is automatically is deduced from it and that this could be
> used through out ruby. just a thought.)

Only if all relevant objects have a universal '.replace'.

> i think there are some deeper consideration to this. if ruby were to
> take one more step in the direction of OO, becoming a Radical OOP, i
> think it would discover another level (or at least semi-level) of power.

Sorry, I'm not a fan of OOP (though I am a fan of ruby). And I don't
think that making '=' copy values would be more radically OO.

> since everything is a subclass of object, there's no reason that
> objects can't switch identities above that.

There is: now we can freely pass immutable objects by reference and
not worry that somebody changes their contents.

Copying is a more fragile concept than rebinding references. When the
mutable state of an object is held in subobjects, it's not clear how
deep we want the copy to be. Rebinding references is clear.

-- 
  __("<      Marcin Kowalczyk
  \__/     qrczak / knm.org.pl
   ^^    http://qrnik.knm.org.pl/~qrczak/