develooper Front page | perl.perl6.language | Postings from March 2009

S08 Draft questions (Captures and Signatures)

Thread Next
Jon Lang
March 31, 2009 22:54
S08 Draft questions (Captures and Signatures)
Message ID:
Yes, I know that there is no S08.  I'm working on writing one, and I'd
like some feedback to help me do so.

My draft is going to be about Signatures and Captures.  Thus, my questions:


* Is it illegal to specify an invocant in a sub, or is it merely
nonsensical?  That is, should the compiler complain, or should it
silently treat the invocant as the first positional parameter?  (The
latter has the advantage that you don't have to worry about what the
signature is being used for; it has the disadvantage of being, well,
nonsensical: invocants are meaningless without the context of a method
- and /maybe/ a role - to provide them meaning.)

* Likewise, if I interpolate a signature with an invocant into another
signature (somewhere other than at the start), is this an error, or
will the invocant be silently converted into an ordinary positional

* What types are you allowed to assign to an invocant?

* Does anyone object to roles having an invocant, and that invocant
referring to the class that is doing the role?


* Why are we using ";;" to denote the end of a multi function's
longname?  I'm thinking that doubling up on the normal delimiter may
make more sense - which would normally mean ",,", but would mean ";;"
if you're using a multidimensional argument list and the longname ends
where a semicolon would normally go.

* Can any required parameter be part of the longname, or are only
positional parameters allowed?  (I'm expecting the latter; but I'd
like confirmation.)

* Are placeholder parameters ever considered to be part of a
function's longname?  (I'm expecting that they aren't: if you want a
longname, you ought to specify it in a formal signature.)

Starting and Ending delimiters:

* Why are pointy blocks forbidden from enclosing their signatures in
parentheses, or from using the ":( ... )" notation?  Is this a
holdover from the early days, when parentheses denoted a list?  Or is
there still a good reason not to allow such notation?

* Why do parameterized roles use "[ ... ]" for their signatures
instead of ":( ... )" or "( ... )"?

Named parameters:

* Must required named parameters be defined before optional named
parameters are, or are we allowed to interleave the two?

Placeholder parameters:

* does the use of placeholder parameters interfere with the use of the
slurpy parameters normally provided by the default signature (i.e.,
*@_ and *%_)?  I'm guessing not.

Jonathan "Dataweaver" Lang

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About