in reply to Re: Builtin functions defaulting to $_
in thread Builtin functions defaulting to $_

The list will certainly change for Perl 6, insofar as it will be an empty list. If you want to default a function call to $_ you use the "unary dot" form:
for 1..10 { .say }
Of course, pattern matching and topicalizers still implicitly deal with $_, but you no longer have to memorize a long list of functions, nor worry about the difference between
rand > 0.5 # means rand($_) > 0.5 rand < 0.5 # parse error looking for fileglob
since in Perl 6 that is unambiguously
.rand < 0.5 # always means rand($_) < 0.5
You don't have to memorize which symbols are true globals either. As for Perl 5's magical use of $a and $b, the less said the better... :-)

Replies are listed 'Best First'.
Re^3: Builtin functions defaulting to $_
by shmem (Chancellor) on Mar 24, 2007 at 13:53 UTC
    You don't have to memorize which symbols are true globals either.
    which will relieve a lot of grief. Like with $! and $@ which may get overwritten if not dealt with in a timely manner. If I well remember, $! will be just a reference to what the current error looks like; therefore the question: what's $@ in Perl 6, if it exists at all? I could think of that as a list of messages of what things blew up from there to here (ie some "exception stack trace excerpt") - but then, that would be more appropriately @$! (in perl5 syntax, that is)...

    update: reading again, not "have(ing) to memorize which symbols are true globals" means: there are no true global symbols, right?

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
      There is no $@ in Perl 6; all errors are unified into the $! object, which can hold all the info it needs to. And in general, those few remaining punctuational variables are all lexically scoped.

      But what I meant was that you don't have to remember that names like STDIN and ARGV are the same symbol in every package. Those are now spelled $*IN and @*ARGS, where the * indicates true global scope; or perhaps just membership in the GLOBAL package, which as you point out arguably means there are no true globals.