Em Ter, 2009-03-31 às 22:54 -0700, Jon Lang escreveu:
> 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:
> Invocants:

The concept of "invocant" only exists in terms of syntax now. In runtime
the invocant is simply the first positional argument. This simplifies
things a lot.

> * Is it illegal to specify an invocant in a sub, or is it merely
> nonsensical?

There's nothing wrong about it. In fact, every time you do "my method"
or "our method", you end up with a sub that has an invocant in its

> silently treat the invocant as the first positional parameter?

Yes, that is basically the major side-effect on the latest capture
change. As I said before, the invocant only exists in terms of syntax,
it doesn't exist in terms of runtime.

> * 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
> parameter?

What does "interpolate a signature" mean?

But anyway, the invocant is the first positional argument, period.

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

It's just a positional argument. But I suppose that on method
declarations, the type of the invocant is ::?CLASS. (Although there is
some debate if it's going to make some declarations too narrow

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

You mean methods declared in a role? Yes, they have an invocant, but the
invocant type in the signature could be just the role, I guess...

> * Why are we using ";;" to denote the end of a multi function's
> longname?

Because a capture may have more than one dimension, which would be
delimited by ";".

> * 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.)

I suspect you meant "named parameter" in place of "required parameter".

For Perl 6.0.0, it is accepted that named parameters don't take part in
multi dispatch.

> * 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.)

placeholder variables are just a simplified way of writing a signature,
after they are compiled, the routine has a regular signature, which
means that it should work as if the signature was explicit.

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

named parameters order are, most of the time, irrelevant. But you can
have the same named parameter twice, iirc. So, I don't think you need to
put mandatory named parameters before the regular ones...

> * 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.

Yes, it does. The default signature is the *default*. Having placeholder
parameters imply defining a signature, one could argue that *...@_ and *%_
are still part of that generated signature, but @_ certainly won't
contain the values that were in the placeholder parameters.


Reply via email to