On Thu, Jul 07, 2005 at 10:43:45AM -0500, Patrick R. Michaud wrote:
> With something like
> 
>     .sub "foo"
>         .param int beta
>         .param string gamma :optional
>         .param string delta :optional
>         .param pmc epislon :slurpy
> 
> So, all we really need is something that can tell us how many :optional
> arguments were filled in.

ITYM "parameters".  I know it's confusing, but at least for now, the
terminology is that arguments are passed and parameters are bound to
(or assigned) the argument values.

If it would otherwise be necessary to keep state, it might be best
included right in the get_params/get_results opcodes.  Say a new bit
":opt_count", which means that the given register should be assigned
the count?

     .sub "foo"
         .param int beta
         .param string gamma :optional
         .param string delta :optional
         .param int optc :opt_count
         .param pmc epsilon :slurpy

In this example, the range of values for optc would be 0..2.  That's
because epsilon is not optional, and will thus always be set to an
aggregate PMC, just maybe an empty one.

It could likely be illegal for :optional to appear after the
:opt_count, not that there's any need for such a thing anyway.

Would that work for everyone?

(I suppose there might be a use case for :optional :slurpy, but I
haven't seen one.  If array PMC creation were expensive enough to make
creating the slurpy array prohibitive, that'd be a bug.  IMO.)
-- 
Chip Salzenberg <[EMAIL PROTECTED]>

Reply via email to