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
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?my ::MySig ::= :(Int, Num, Complex, Status :mice); :(Num Dog|Cat $numdog, MySig \$a ($i,$j,$k,$mousestatus));
A little higher,
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?@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()
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |