On Tue, 25 Oct 2005, Juerd wrote:
Reducing line noise isn't my goal, though. I feel that the implicit
defaulting to $_ makes Perl a more natural and elegant language, and
would like this principle being extended to these operators.
Indeed, both the implicit defaulting to $_ AND the availability of $_
itself. Which occasionally makes me desire even more pronouns. After all
in a natural language like English we have 'it', 'them', 'we', etc... now
it's obvious that
(i) we can't hope nor desire a full correspondence,
(ii) there _already_ are some analogues of _some_ of the above, but
somewhat more limited in usefulness wrt $_.
Now, one that I've sometimes desired is a "two level" $_, i.e. a variable,
say, $__ referring to the _second next_ enclosing lexical scope. I am
aware that in this vein one may ask a third analogue and so on, but let's
face it: $_ already covers 95% of cases, my hypothetical var would cover I
guess a remaining 4.5% of cases, and who cares for the rest? E.g.:
for @vert {
put_point $_, $__ for @horiz;
}
Note: I am aware that P6 will already provide other ways to do it, but
this is not in contrast with Perl's TMTOWTDI-ness. I expect it to be
useful enough in nested {map,grep}'s.
Michele
--
you look around what do you see?
I'll tell you what I see is a world belonging to me
- Pennywise, "Living For Today".