Chip Salzenberg wrote:
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)
This needs more parsing rules in imcc.y so it's not (yet) implemented.
But I've now implemented :opt_count, with an extension to the original
proposal: the opt_count is reset after :opt_count is seen, so that
multiple :opt_count flags work.
.param pmc p1 :optional
.param pmc p2 :optional
.param int i12 :opt_count # = 2
.param pmc p3 :optional
.param int i3 :opt_count # = 1
(if these argumens are passed of course)
leo