-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discussion about syntax-case #7
Comments
PS The low-level macro system found in the appendix of R4RS, which was cited, is basically the |
Thanks for the comments! This doc was mostly meant as quick research notes while trying to figure out what to do and probably shouldn't have stayed on the repo as-is. I turned these notes into a hopefully more accurate and less hyperbolic summary at https://terbium.io/2020/05/macros-scheme/ (which, funnily enough, mentions you when talking about syntactic closure limitations). I will replace the discussion in this repo with the version on my website. I didn't actually take a deep look at the low-level R4RS macro system at the time, and didn't realize it was related to |
Thanks for pointing out your blog post! It is always great to see people promoting Scheme! If you allow me two more comments: At the end, you cite my Chibi patch to prove that (library (lib)
(export foo bar)
(import (rnrs))
(define bar 1)
(define foo #'bar))
(import (rnrs) (lib))
(define-syntax quux
(lambda (x)
foo))
quux ; => 1 Here, the syntax object to which This cannot be emulated with an ER or SC system (this also means that they are less suited for writing large hygienic macros, whereby large, I mean a macro whose transformer picks up pieces from different libraries or helper procedures). It would greatly improve peroxide if it were built on a native implementation of The second comment is about the "excellent message by Alex Shinn", whom I otherwise greatly respect for his contributions to Scheme. It is obvious that he didn't fully understand -- |
I would like to address some inaccuracies in the discussion on macro systems in Scheme: https://github.com/MattX/peroxide/blob/master/doc/macros.md, so let me give a number of facts:
syntax-case
is hygienic by default; however, usingdatum->syntax
can be used to break hygiene explicitly. In particular, one cannot write an unhygienic macro by accident. (Compare with ER macros, where one has to be very careful to maintain hygiene.syntax-case
is no more complex to implement than syntactic closures, for example.syntax-case
will be part of the large language of R7RS.syntax-case
on top of syntactic closures. I wrote Chibi's implementation but that implementation is not fully compliant (it cannot be because of the limitations of syntactic closures).syntax-rules
macros.syntax-case
; for example, the unhygienicdefine-record-type
of SRFI 99 cannot be expressed with syntactic closures.The upshot is that from the set of discussed macro systems, only
syntax-case
turns out to be a viable choice.The text was updated successfully, but these errors were encountered: