On 13/11/2013 12:47, Xavier Noria wrote:
>
> In Ruby
>
>      s = "foo"
>      t = s
>
>      s << 'bar'
>      puts t
>
> prints "foobar". Everything are references, s holds a reference to a
> string, t hods the same reference, therefore in-place mutations are seen
> in both of them.
>

I get that but it sets up an expectation that this:

x =2

def f(y)
   y = y + 1
   puts y
end

f(x)

... will mutate x but I now understand, from what others have explained, 
that it doesn't. It's just counter-intuitive, that's all. This and the 
various rules about symbols as named arguments have led me to the 
conclusion that Ruby is an unnecessarily complicated language. Perl is 
much simpler.

gvim