Apologies for raising the dead (horse)

On Thu, Nov 07, 2002 at 03:27:51PM -0600, Me wrote:
> Damian:
> > ["it" will be passed to about 5% of subs,
> >  regardless of whether the context is your
> >  10 line scripts or my large modules]
> 
> If the syntax for passing "it" to a sub
> remains as verbose as it currently is,
> you are probably right that "it" won't
> be used to achieve brevity! I think it's
> a pity given that the core point of "it"
> is to achieve brevity.
> 
> Why do you think your estimate of Perl 6
> usage of "it" is so much lower than is
> true for the standard Perl 5 functions?

If a subroutine explicitly needs access to its invocant's topic, what is so
wrong with having an explicit read-write parameter in the argument list that
the caller of the subroutine is expected to put $_ in?

It makes it clear.

If I understand all this correctly, as is, this "access caller's topic"
is an unrestricted licence to commit action at a distance.

Accessing the caller's topic is the default in perl5. And there is still a
steady stream of bugs to p5p where core perl modules are doing something
(typically a while loop) which tramples on $_, and so makes something go
wrong in their caller. (possibly several levels down)

(And for that matter the "obvious" solution of local ($_) in perl5 is also
action at a distance if $_ is tied, as local is an immediate fetch and a
store at end of scope. Special case local on $_ ?)

Nicholas Clark
-- 
perl6 better than perl (this week)?   http://www.perl.org/advocacy/spoofathon/
[Alledgedly some judging activity soon. Yeah, right. Pull the other one]

Reply via email to