Email list hosting service & mailing list manager

optional argument notation Marc Feeley (18 Dec 2000 20:58 UTC)
Re: optional argument notation shivers@xxxxxx (18 Dec 2000 21:14 UTC)
Re: optional argument notation Marc Feeley (18 Dec 2000 21:35 UTC)

Re: optional argument notation Marc Feeley 18 Dec 2000 21:35 UTC

> It must be misleading, since you got it wrong both ways! a [b c d] means
> these are all OK:
>   a
>   a b
>   a b c
>   a b c d
>
> I find the pedantic alternative of writing, e.g.,
>        string-hash    s [bound [start [end]]] -> integer
> too ugly and hard to parse.
>
> If there *were* a case where optional args were "chunked," it would be
> rare enough that I could simply mention it in the accompanying text.
>
> I will add a little explanatory paragraph to the SRFIs describing the
> meaning of this notation. How's that?

By doing this you will be going against a long standing standard
(BNF, etc).  So my preference is that you use the pedantic form

       string-hash    s [bound [start [end]]] -> integer

Otherwise, why don't you use a different kind of parens, for example

       string-hash    s {bound start end} -> integer

or even a marker such as

       string-hash    s #!optional bound start end -> integer

Marc