From: Angel Martin Date: 2004-05-20T00:29:43+09:00 Subject: Re: Arguments and formal variables El mi�, 19-05-2004 a las 16:38, Robert Klemme escribi�: > "Angel Martin" 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 :-( 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. > 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. Thanks, Angel