> Can Ceran wrote: >> Hi, >> I have also some another thing in Ruby that I am not sure about. >> What kind of storage binding is used in Ruby, as far as I understand >> there are no static variables (i'm not sure again), then Ruby uses >> both >> stack-dynamic and heap-dynamic variables or just stack-dynamic? > > You can determine storage by the notation: > > stack > ----- > x = 1 > ... {|x|...} > def meth x > > heap > ---- > @x = 1 > @@x = 1 > $x = 1 I'm pretty sure you're being misleading there. You can determine the _scope_ of a variable by it's notation / prefix. Function's scope: x=1 Object's scope: @x=1 Class's scope: @@x=1 Global scope: $x=1 Variables themselves are all references to objects. When you do: a = b or @a = b etc You are really saying: "make the variable 'a' reference what ever the variable 'b' is referencing." You are not actually changing any of the underlying objects (this is completely different from c++, for example). As far as I know, the storage of the actual objects is heap based, but really, that's an implementation issue. You don't care where it is (probably). You're not exposed to this concept by the semantics in the Ruby programming model. Cheers, Benjohn