From: "Patrick R. Michaud" <[EMAIL PROTECTED]>
   Date: Wed, 28 May 2008 23:14:06 -0500

   On Wed, May 28, 2008 at 10:05:32PM -0400, Bob Rogers wrote:
   >     Pos? Named? Reqd? => Example
   >     yes  no     yes   => .param pmc A
   >     yes  no     no    => .param pmc B :optional
   >     yes  yes    yes   => .param pmc C :lookahead('c')
   >     yes  yes    no    => .param pmc D :optional :lookahead('d')
   >     no   yes    yes   => .param pmc E :named('e')
   >     no   yes    no    => .param pmc F :optional :named('f')
   > 
   > I can see why B has to be after A and before C, and I assume ":lookahead
   > before :named" makes the implementation easier, but I can't see the need
   > for any particular ordering of C vs. D, or E vs. F.  Am I missing
   > something?  Just curious,

   C needs to come before D because all required positionals need to be
   filled before we get to the optional ones.

But there are two ways to fill a :lookahead positional . . .

   ================
   From: Allison Randal <[EMAIL PROTECTED]>
   Date: Thu, 29 May 2008 10:42:31 +0200

   . . .

   But you can never switch to optional in the positional parameters and 
   then switch back to required in the lookahead parameters:

      .param pmc A
      .param pmc B :optional
    * .param pmc C :lookahead('c')           # syntax error
      .param pmc D :optional :lookahead('d')

Hmm.  Seems to me that a minimal call to this sub could look like:

        foo(1, :c(3));

which (if I haven't butchered the P6 syntax) would bind A to 1 and C to
3, leaving B and D unbound.  I don't have a real use case for this,
though.

   And agreed that the ordering of the named-only parameters doesn't
   really matter, but for code maintenance sanity and possible future
   optimizations, let's say that required named-only parameters must
   come before optional named-only parameters.

   Allison

Sounds reasonable.

                                        -- Bob

Reply via email to