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

Re: The ". $" notation

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



Alan Manuel Gloria:
> >> 1.  Allow "foo . EOL INDENT x ..." ==> "(foo . (x ...))"
> >> 2.  Allow "foo . $ x ..." ==> "(foo x ...)"

Unfortunately, those 2 forms greatly differ in ease-of-implementation.

The *second* form is easy to add to the BNF.  Here's the patch:

diff --git a/sweet.g b/sweet.g
index 82055ea..937e54d 100644
--- a/sweet.g
+++ b/sweet.g
@@ -1061,6 +1061,7 @@ rest returns [Object v]
         (pn=n_expr hspace* (n_expr error)? {$v = $pn.v;}
          | COLLECTING hspace* pc=collecting_tail hspace*
            (n_expr error)? {$v = $pc.v;}
+         | SUBLIST hspace* ps=rest {$v = $ps.v;}
          | empty {$v = list(".");})
        | empty   {$v = list(".");})
   | scomment hspace* (sr=rest {$v = $sr.v;} | empty {$v = null;} )


So we could easily support form #2, and I don't see any big downside.
I'll post the ANTLR patch on git; we can revert it later, or implement it in the
Scheme implementation, depending on what people say.

I don't see an obvious way to add the first form to the BNF, though, and
I don't think we should reorganize everything for such a bizarre case.
Also, I can see form #1 being created accidentally, so *preventing* it seems wise.

Granted, that's a minor inconsistency, but ". $" is such a bizarre useless
sequence that I'm going to lose any sleep over it (if we add it).

--- David A. Wheeler