Skip to content

Discussion about syntax-case #7

Description

@mnieper

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, using datum->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.
  • That no one cared about R6RS is utterly wrong. People still care about R6RS because it was not succeeded by R7RS, which is to be seen as an independent successor of R5RS.
  • R7RS did not supersede R6RS.
  • syntax-case is no more complex to implement than syntactic closures, for example.
  • syntax-case will be part of the large language of R7RS.
  • It is not possible to implement 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).
  • It is not possible to write unhygienic macros that work in all contexts with ER macros.
  • Unhygienic macros written with syntactic closures are incompatible with hygienic syntax-rules macros.
  • Syntactic closures are strictly less powerful than syntax-case; for example, the unhygienic define-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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions