On Fri, Jul 08, 2005 at 03:58:50PM +0200, Leopold Toetsch wrote: > Chip Salzenberg wrote: > >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.
I'll note that with Leo's resetting version of :opt_count, we might not really need the parameterized form of :optional, since one can simply do: .sub "foo" .param int beta .param string gamma :optional .param int have_gamma :opt_count .param string delta :optional .param int have_delta :opt_count and each of have_gamma and have_delta is 0 or 1, depending on the parameter before it. And if a subroutine only needs the total count of optional parameters, there's an easy way to do that. OTOH, the :optional(reg) syntax has its uses as well. At any rate, having both available seems to give a nice level of flexibility to subroutine authors (I haven't thought too deeply yet about potential conflicts/confusions). Pm