From: Thomas Hafner Date: 2007-08-13T18:09:59+09:00 Subject: Re: global_variable_set (like instance_variable_set) "Gregory Brown" wrote/schrieb : > On 8/12/07, Thomas Hafner wrote: > > "Gregory Brown" wrote/schrieb : > > > > Nevertheless, if Ruby had explicit references (does it?), it would be > > simple enough to have just one function instead of the original both > > ones > > You'll want to catch up on this thread: > http://rubyurl.com/FrJ This thread treats ``pass by reference'' which is like aliasing. With ``explicit references'' I rather mean explicitly referencing (by operator ``&'' in C resp. ``\'' in Perl) and dereferencing (by operator ``*'' in C resp. ``$'' in Perl). Here's a Perl example: sub foo { my ($ref) = @_; # consume argument array ${$ref}++; # dereference and increment } my $bar = 3; foo(\$bar); # make a reference to $bar and pass it to the function print $bar; # => 4 Regards Thomas