"Angel Martin" <angel / tyrex.mine.nu> schrieb im Newsbeitrag
news:1084980569.26803.69.camel / tyrex.mine.nu...
> El mi?, 19-05-2004 a las 16:38, Robert Klemme escribi?:
> > "Angel Martin" <angel / tyrex.mine.nu> schrieb im Newsbeitrag
> > news:1084970490.26805.37.camel / tyrex.mine.nu...
> > > In first place I sorprised with te behavior of formal variables inside
a
> > > metod or proc:
> >
> > Why are you surprised?  Formal method / proc parameters and bound to
some
> > ruby instances on method invocation.  Whenever you assign to them from
> > inside the method / proc, only this variable binding changes.  These
> > variables are not aliases for any other variables.
>
> Because a C pointer view :-)
>
> It seems to me that the arguments in method are new instances of the
> container, I mean:
> 'a' outside is a pointer(in C) to the struct that hold the container of
> ref to obj
> 'a' arguments is a pointer to a new struct which contains the same ref,
>
> If assign (=) change the ruby ref of the container, but in the new scope
> 'a' is now a container.dup, I can't change the ref outside :-(

If you replace "contianer" by "reference" then you get it right IMHO.

> The sentence "In Ruby all object are passed be reference" give me a
> 'pointer view' of this.
>
> The Array wraping values IHMO seems to be a little Ugly, but simple
> enought to me.

Personally I've never felt the need in a method to change a binding in the
calling context.  Why do you think you need that?

> > If they would be, you
> > could not do this, because initialization is done from an expression
> > evaluation and not a variable:
> Please, can you explain a litle more about?
> What is the difference in initialization between a expresion evaluation
> and a variable if expresion return some type of value.

An expression is not an lvalue (something you can assign to).  There's no
place (like a variable), just a value (in Ruby: an object).

Regards

    robert