in reply to Re: RFC: Is there more to alias?
in thread RFC: Is there more to alias?

Heh, I wonder if I'm missing something, but it appears that Data::Alias's interface is better in several ways than Perl6's. How will Perl6 support the following tasks other than with these relatively ugly hacks:

$w = alias [$x, $y, $z]; # vs. $w[0] := $x; $w[1] := $y; $w[2] := $z; alias push @x, $y; # vs. push @x, 0; @x[-1] := $y; alias my( @x )= @y; # vs. @x= (); @x[$_] := @y[$_] for 0 .. @y.last; alias my( @x )= GetList(); # vs. is this possible with Perl6's syntax?

Perhaps Perl6 should have 'alias' built in along with the more succinct := operator?

- tye        

Replies are listed 'Best First'.
Re^3: RFC: Is there more to alias? (perl6)
by Aristotle (Chancellor) on Aug 25, 2004 at 15:34 UTC

    The following might work, and if so would cover several of the cases:

    push @x, my $x := $_ for @y;

    But that's still much clumsier than Data::Alias.

    I have a hunch though that in Perl6 we'll be using the splat to do this, something remotely looking like

    *@x := *@y;

    Don't ask me about the precise syntax though.

    Makeshifts last the longest.