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

I didn't think you were parsing anything but I misunderstood what alias does and so assumed that my parsing of alias push @x, $y was wrong. I'm used to thinking of "alias this to that" rather than "turn on aliasing for this bit of code".

I know you changed the lexer to make this unnecessary but I think syntax like

alias { push(@x, y) }
would give a clearer indication of what is going on. It would also cause problems with scoping when you want to use my:-(

Replies are listed 'Best First'.
Re^8: RFC: Is there more to alias?
by xmath (Hermit) on Aug 25, 2004 at 09:04 UTC
    You can use either syntax, so if you think alias { push(@x, $y) } is clearer, use that. (I'm personally a fan of sparse use of parens and braces, but maybe that's just my strange taste). Note however indeed that if you try to do my-declarations, you can run into trouble... alias { my $x = $y } would do nothing useful, since the scope of $x is limited to the block.

    On a side note, the lexer hack is actually to make alias { .. } work. alias LIST is the normal mode of operation.