And I just realized my proposal fails to address something important.
But I'm not entirely sure it's Parrot's job to do the important thing
in question.  Still, the possibility exists.  Thus:

On Thu, Jul 07, 2005 at 12:02:40PM -0400, Chip Salzenberg wrote:
>      .sub "foo"
>          .param int beta
>          .param string gamma :optional
>          .param string delta :optional
>          .param int optc :opt_count
>          .param pmc epsilon :slurpy

This fails in the face of the named parameter calling sequence, which
can end up passing delta with a value but omitting gamma.  Of course
the get_params opcode doesn't yet have a way to specify parameter
names, but it likely will have to soon.

Thus, this is probably better:

     .sub "foo"
          .param int beta
          .param string gamma :optional(have_gamma)
          .param string delta :optional(have_delta)
          .param pmc epsilon :slurpy

This implies declaration of integer (pseudo-)registers named
"have_gamma" and "have_delta".  If gamma was passed, then have_gamma
will be true, else false.

This would be syntactic sugar for something like:

     .sub "foo"
          .param int beta
          .param string gamma :optional
          .param int have_gamma :got_last_optional
          .param string delta :optional
          .param int have_delta :got_last_optional
          .param pmc epsilon :slurpy

This allows for the possibility of named parameter passing, and it
also is even more robust against signature changes than :opt_count
would have been.
-- 
Chip Salzenberg <[EMAIL PROTECTED]>

Reply via email to