|
The ". $" notation (was: Re: how useful are collecting lists?)
Alan Manuel Gloria
(18 Mar 2013 01:26 UTC)
|
|
Re: The ". $" notation
Shiro Kawai
(18 Mar 2013 02:42 UTC)
|
|
Re: The ". $" notation
Alan Manuel Gloria
(18 Mar 2013 02:44 UTC)
|
|
Re: The ". $" notation
Shiro Kawai
(18 Mar 2013 04:45 UTC)
|
|
Re: The ". $" notation
David A. Wheeler
(18 Mar 2013 16:25 UTC)
|
|
Re: The ". $" notation Alan Manuel Gloria (19 Mar 2013 00:17 UTC)
|
|
Re: The ". $" notation
David A. Wheeler
(19 Mar 2013 03:28 UTC)
|
|
Re: The ". $" notation
Alan Manuel Gloria
(19 Mar 2013 05:52 UTC)
|
|
Re: The ". $" notation
David A. Wheeler
(19 Mar 2013 10:44 UTC)
|
|
Handling scomments after "."
David A. Wheeler
(19 Mar 2013 03:41 UTC)
|
|
Re: Handling scomments after "."
David A. Wheeler
(19 Mar 2013 04:12 UTC)
|
|
Re: The ". $" notation (was: Re: how useful are collecting lists?)
David A. Wheeler
(18 Mar 2013 03:09 UTC)
|
On 3/19/13, David A. Wheeler <xxxxxx@dwheeler.com> wrote:
> 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).
There's a subtle problem with ". $" though...
First:
a $ b
===>
(a b) ; as described in the rationale for SUBLIST.
Then:
a . $ b
===>
(a . b)
???
Hmm.
Sincerely,
AmkG