On 8/13/07, Thomas Hafner <thomas / hafner.nl.eu.org> wrote:
> "Gregory Brown" <gregory.t.brown / gmail.com> wrote/schrieb <b37300880708121715x1d92719fjd0311d10e10bc24a / mail.gmail.com>:
>
> > On 8/12/07, Thomas Hafner <thomas / hafner.nl.eu.org> wrote:
> > > "Gregory Brown" <gregory.t.brown / gmail.com> wrote/schrieb <b37300880708121526j299f1ed3t3b7e45851d9ec0e9 / mail.gmail.com>:
> > >
> > > 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

Sure, but it's the same idea.  You're trying to change the binding of
$bar from a different scope

-greg