Ovid writes:
> You know, this should be simple and maybe I'm overlooking something
> obvious. I was trying out Pugs and my first program worked great:
>
> for 1 .. 6 -> $var {
> say $var;
> }
>
> The second version didn't:
>
> for 1 .. 6 {
> say;
> }
>
> For the life of me, I can't recall if "say" (or "print", for that
> matter) should default to the current topic. So I figured I would
> check the docs. Grepping for "say" or "print" is like trying to sip
> from a firehose. I realize it's unlikely that we have an index for the
> Perl6 docs, but though it would be nice. I guess we can wait for the
> phantom volunteer on that :)
Well, say does default to $_. But grepping the synopses can be a bit
difficult. I don't believe the semantics of say are spelled out in the
synopses anyway :-)
Once the perl 6 implementation gets more mature, I'd love to start a
"learners reference". It's an idea I've had for a while. Basically,
when you see an expression like:
begin $handle: $x <== 1..5;
You might not understand all of it. You'd look up 'begin' in this
document, to find nothing (which would be indicative that it is
user-defined, not that it isn't in this document. This document would
have a very brief description of everything, with information about
where to find more information). Then you'd look up <==, because that's
the next biggest thing you don't understand. And it would tell you.
Then you'd look up :, and look through the examples to see which one
matches the context you're looking at (that's how we would handle
overloaded symbols). A document like this makes it a lot less scary to
add new syntax to the core (which may or may not be a good thing), and
will certainly improve the learnability of Perl 6 by reading rather than
writing, a property that Perl 5 never had.
Luke