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:
my ($foo,$bar,$baz,$i);
for my $quux ($foo, $bar, $baz) {
$quux = $i++;
}
print "$foo $bar $baz\n";
__END__
0 1 2
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:
sub wibble {
return unless @_ > 2;
my ($string, $position, $count) =
map { alias } @_;
# . . .
}
where you wish to modify the external arguments.
I expect this sort of thing has been discussed before.