cyclone icon indicating copy to clipboard operation
cyclone copied to clipboard

Add syntax-case support

Open justinethier opened this issue 3 years ago • 4 comments

It may be possible to support syntax-case by porting the implementation from Chibi: https://github.com/ashinn/chibi-scheme/pull/500/files

justinethier avatar Apr 12 '21 21:04 justinethier

Hi @justinethier! Any plan to implement syntax-case in the near future?

arthurmaciel avatar Oct 21 '21 02:10 arthurmaciel

Hi @arthurmaciel!

There has been discussion of this topic on IRC with the recent voting for the R7RS Large Yellow Edition.

Unfortunately, after reading through the comments and looking at this again, the Chibi implementation uses syntactic closures (SC) as well as ER macros:

2021-10-20 02:56:42 gwatt: the issue, afaik, is that for explicit renaming, symbols are identifiers, whereas in syntax-case, syntax objects are identifiers 2021-10-20 02:59:00 ISTR it works the other way around though: implementing syntax-case on top of er macros 2021-10-20 02:59:58 no, there you have the issue that ER only gives you two contexts to inject identifiers into/grab them from (either using rename or a bare symbol), whereas syntax-case lets you do it at any timestamp for which you already have another marked syntax-object 2021-10-20 03:00:58 Chibi's implementation has to use the 'other' low-level macro system in Chibi, syntactic closures, to work around this. and even then, MNW told me it has some limitations

Since Cyclone does not support SC that would need to be implemented first before any of this code could be ported over.

Anyway, no plans to do this immediately but it will be interesting to see how the Yellow Edition voting goes. As of now there is a lot of support for syntax-case: https://docs.google.com/forms/d/e/1FAIpQLScAfyfkdq2eL5LgrUyatufD-iIcKGCKIOq-A6IrmsKW-RxdkQ/viewanalytics

justinethier avatar Oct 21 '21 15:10 justinethier

syntax-case could potentially be implementing using unsyntax. See: https://github.com/justinethier/cyclone/issues/486

justinethier avatar May 23 '22 19:05 justinethier

See also the sample implementation from SRFI 72 - https://srfi.schemers.org/srfi-72/srfi-72.html

justinethier avatar May 25 '22 19:05 justinethier