On aliases, I wish Perl had more of 'em. This doesn't really have a lot to do with your meditation, but the topic made it spill out.
I'd like to have lexical variables which are aliases to other values. Currently, you only get that by defining a for loop variable:
I think that explicit aliasing which gives value semantics to references would be very desirable. A new alias keyword taking $_ as default argument would allow, for instance, named aliases for subroutine arguments:my ($foo,$bar,$baz,$i); for my $quux ($foo, $bar, $baz) { $quux = $i++; } print "$foo $bar $baz\n"; __END__ 0 1 2
where you wish to modify the external arguments.sub wibble { return unless @_ > 2; my ($string, $position, $count) = map { alias } @_; # . . . }
I expect this sort of thing has been discussed before.
After Compline,
Zaxo
In reply to Re: Aliasing bites
by Zaxo
in thread Aliasing bites
by ambrus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |