[r6rs-discuss] Library naming ambiguity?

AndrevanTonder andre at het.brown.edu
Tue Jun 12 10:51:21 EDT 2007


> This ambiguity can be removed either by:
>
> [1] Not allowing 'except' 'only' 'and' etc. as <identifier>s of
>    the library.
>
> [2] By requring at least one <identifier> in except clause etc.

...and at least one <import level> in "for" clauses.

> The latter can certainly patch this specific problem, but I feel
> that the real problem is that the import syntax is too terse,
> conflating lists to carry too many meanings.  It took some time
> for me to grok the import syntax described in 6.1.

I agree that it is hard to parse visually.  It is also, in its
current form, very easy to code incorrectly.

> - Make 'only' etc. as qualifiers following <library-name>,
>  instead of making them prefixed clause, e.g.
>
>  (import (<identifier> <identifier>...)  ; <library-name>, except <version>
>          only    <identifier> ...
>          except  <identifier> ...
>          version <version-reference>)

I like this.  This is much more readable, although this would need more 
parentheses to be unambiguous, for example:

   (import (<identifier> <identifier>...)  ; <library-name>, except <version>
           (only    <identifier> ...)
           (except  <identifier> ...)
           (version <version-reference>))

Apart from much better readability, a big reason I like your proposal more is 
that it avoids proliferation of parentheses.  The current syntax expresses 
composing of import modifiers in prefix  notation, which can lead to a 
proliferation of parentheses.  I particularly like your postfix notation 
because it can express an arbitrary number of compositions in a constant 
nesting level.  I believe it will also be much easier to code a reliably 
correct parser for it.

Andre



More information about the r6rs-discuss mailing list