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

From: Mark H Weaver <[email-masked]>
Date: Mon, 18 Nov 2019 10:10:30 -0500

Hi Andy,

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.

> 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'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.

       Mark