Hi, I'm in the processes of reviewing reader behavior for a number of different lisp dialects and Guile has a quirk that I have been unable to find any documentation about. Specifically, as far as I can tell apostrophe is not allowed in identifiers according to the formal grammars for r5rs through r7rs (I have not checked earlier versions). In addition apostrophe is not included in the extended reader syntax in the manual. However, 'a'b'c reads as a'b'c in guile 2.2.6. Am I missing something? Is this a bug? Best! Tom
On 30.12.2020 05:51, Tom Gillespie wrote:
> Hi,
> I'm in the processes of reviewing reader behavior for a number of
> different lisp dialects and Guile has a quirk that I have been unable
> to find any documentation about. Specifically, as far as I can tell
> apostrophe is not allowed in identifiers according to the formal
> grammars for r5rs through r7rs (I have not checked earlier versions).
> In addition apostrophe is not included in the extended reader syntax
> in the manual. However, 'a'b'c reads as a'b'c in guile 2.2.6. Am I
> missing something? Is this a bug?
Hi Tom,
It's quite common for implementations to extend the standard, so
something that's "an error" in the standard might be allowed in an
implementation.
This is evidently one of those cases.
I would not *rely* on Guile supporting this either though. Maybe in a
future version the reader will be changed and it will stop working.
- Taylan
Hi Taylan, Thank you for the explanation. Replies in line. Best! Tom > It's quite common for implementations to extend the standard, so > something that's "an error" in the standard might be allowed in an > implementation. In this instance I think the situation is worse than if the standard said this was an error. In fact the standard doesn't say this is an error at all, which would be better than the current situation. Where nearly all other implementations will read 'a'b'c as three separate symbols, Guile reads it as a single symbol, silently diverging from the standard without warning (until something comes crashing down as a result of the difference later). > This is evidently one of those cases. Unfortunate that it does not seem to be documented anywhere. Would it make sense to bring this up on the dev mailing list and submit a patch to the documentation to indicate where guile is incompatible with the standard? > I would not *rely* on Guile supporting this either though. Maybe in a > future version the reader will be changed and it will stop working. For now I will mark it as a quirk that will have to be tracked.
On 05.01.2021 00:12, Tom Gillespie wrote:
> In this instance I think the situation is worse than if the standard
> said this was an error. In fact the standard doesn't say this is an
> error at all, which would be better than the current situation.
> Where nearly all other implementations will read 'a'b'c as three
> separate symbols, Guile reads it as a single symbol, silently
> diverging from the standard without warning (until something
> comes crashing down as a result of the difference later).
Hmm, I'm looking at the R7RS-small BNF (haven't checked the other
standards) and I think you're right.
The apostrophe is a token of its own, along with <identifier>, which I
think would mean that 'foo'bar should be parsed as four tokens.
It might be worth taking this up with the devel mailing list then.
- Taylan