Subject: bug#38236: R7RS reader does not support datum labels

From: Andy Wingo <[email-masked]>
Date: Mon, 18 Nov 2019 19:35:56 +0100

Hey!

On Mon 18 Nov 2019 16:10, Mark H Weaver <[email-masked]> writes:

> Andy Wingo <[email-masked]> writes:
>
>> R7RS defines a lexical feature called "datum labels"; see section 2.4 in
>> the report.  An example would be:
>>
>>    #0=(a b c . #0#)
>>
>> Guile's reader doesn't support this feature and it's not clear if we
>> should, in general.
>
> FYI, I already implemented R7RS datum labels on the 'r7rs-wip' branch
> (not to be confused with your new 'wip-r7rs' branch):
>
>   https://git.savannah.gnu.org/cgit/guile.git/commit/?h=r7rs-wip&id=92408ac20e921583b8e4ee26463dc5805ef01153
>
> It depends on the preceding commit on the same branch:
>
>   https://git.savannah.gnu.org/cgit/guile.git/commit/?h=r7rs-wip&id=f687871eceb94bded109569880e696d8862d84fd
>
> There was also a later commit on that branch that enabled compilation of
> cyclic literals, but it's no longer applicable to the 'master' branch.

Neat!  I had entirely forgotten about this branch.

>> Note, datum literals appear to be incompatible with array literals.
>
> Can you elaborate on why you believe they're incompatible?  I haven't
> looked closely in a while, but I didn't see any incompatibility when I
> implemented this before.  Datum labels have '#' or '=' after the
> numeral, and I'm not aware of any Guile array syntax that does.

I was wrong.  Thanks for the correction!

> I'm also a bit puzzled why you're apparently planning to rewrite
> everything I already did on the 'r7rs-wip' branch.  The main issue on
> that branch is that the implementation of *writing* cyclic data turned
> out to be a mess, but it could be removed or replaced without affecting
> much else.

I had totally forgotten about it.  I am surprised no one on #guile
brought it up either when I was discussing this work!

As you can see, the the writing implementation currently uses srfi-38.

For what it's worth, I do not have future plans to work on R7RS -- I
just wanted --r7rs so that I could have an easy way to benchmark against
other Scheme systems.  A strange reason, admittedly!

Andy