Hi --

On Fri, 6 May 2005, Eric Mahurin wrote:

> The original intent was to have a way to modify these
> references that variables contain.  This provides a general way
> of doing this.

Doesn't assignment do that?

> A side effect is that you can do a lot more
> though - all you need is a way to get and set the thing you
> want to access.
>
> x = ref{:a} # allows you to get/set the reference that :a has
>
> x[]         # get the object that :a has
> x[]=...     # set the object reference that :a has
>
> Here is another example (pass by reference):
>
> def swap(a,b)
>    tmp = a[]
>    a[] = b[]
>    b[] = tmp
> end
>
> swap(ref{:x},ref{:y}) # swap the object references in x and y
>
> See how useful this thing is?

I haven't seen any cases where I'd have wanted to have it, but I think
experimentation of this kind is always interesting, even if not
everyone has a direct use for it.


David

-- 
David A. Black
dblack / wobblini.net