Please excuse the "batch mode" questioning, but this is the fist time I've had Internet access since my previous post. At least I'll keep all the questions related.

S02 states, "When cast into an array, you can access all the positional arguments; into a hash, all named arguments; into a scalar, its invocant." What is the "invocant" of a Capture object?

A short while later, "...When applied to a Capture argument of form \$x, the signature allows you to specify the types of parameters that would otherwise be untyped" and gives the example

my ::MySig ::= :(Int, Num, Complex, Status :mice); :(Num Dog|Cat $numdog, MySig \$a ($i,$j,$k,$mousestatus));
You lost me there. What is the purpose of $a? Is $a being captured or declared? What are the ramifications of having $i, $j, $k, and $mousestatus inside another set of parens? How would you "pass" values to this Signature containing a nested signature?

A little higher,

@x[f()] = g(); # list context for f() and g() @x[f()] = +g(); # list context for f(), scalar context for g() @x[+f()] = g(); # scalar context for f() and g()
The prefix operator + will not just convert its argument to a number, but impose scalar context on its argument as well? Even so, how does its use in the third line affect g()? The result of +f() is a number, but in the other lines, what if f() returned a number anyway, even when called in list context? Does + somehow reach outward, rather than just inward?

A little farther on, what is the difference between &foo($arg1, $arg2) and &foo.($arg1, $arg2), and are either specific to using the explicit & sigil rather than leaving it off? Much earlier, I recall the dotted form being used with a "long dot" to allow extra space. But now with the more general "unspace", is a dotted form still necessary? E.g. foo\   (42) vs foo\   .(42)?

Meanwhile, In S02, statment_control:if is mentioned as a "multiply-dispatched grammatical rule". What is that?

—John
writing from 昆明, China


In reply to [Perl 6 S02] Capture and Signature Basics by John M. Dlugosz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.