[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: optional argument notation

This page is part of the web mail archives of SRFI 14 from before July 7th, 2015. The new archives for SRFI 14 contain all messages, not just those from before July 7th, 2015.

> 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