develooper Front page | perl.perl6.language | Postings from July 2006

Re: binding operators and related introspection

Thread Previous
From:
Sam Vilain
Date:
July 17, 2006 14:37
Subject:
Re: binding operators and related introspection
Message ID:
44BC02CE.9010203@vilain.net
Darren Duncan wrote:
> But I would also like to have an easy way to change all bindings to 
> the same variable at once to point to the same new variable. 
> [...]
>    my $x = 'foo';
>    my $y = 'bar';
>    my $z := $x;    # $x and $z point to same 'foo', $y to a 'bar'
>    $z.rebind_all_aliases_to( $y ); # $x and $y and $z all point to 'bar'
>   

Maybe we need ruby's Object.all or whatever it is. Then you can write
something like

Object.all.grep:{ $_ =:= $z }.map{ $_ := $y };

Sam.



Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About