David L. Nicol wrote:
>
> I recalled hearing about a language where
> you set the return value of a function by
> assigning to the name of the function within the function body,
Fortran and Pascal do that. Maybe others.
> It would mean that
>
> sub subname(proto){
> # in here, the bareword "subname" is a magic
> # alias for the lvalue this routine is getting
> # assigned to, if any.
> }
But that raises a potential conflict with another proposed magical
meaning of the subname within the sub: as a label for the beginning
of the sub. I.e.
sub foo {
bar();
}
is effectively
sub foo {
foo:
bar();
}
so that, for example, redo works kinda like the perl5 goto &foo:
sub foo {
bar();
redo; # which is shorthand for:
redo foo; # like goto &foo;
}
Proposals along these lines came up in the thread "$a in @b",
in the subsequent discussion of RFC 199, and probably in other
threads.
--
John Porter
A pessimist says the CPU is 50% utilized.
An optimist says the CPU is 50% unutilized.
A realist says the network is the bottleneck.