Mark, 2018-05-29 17:01 GMT+02:00 Mark H Weaver <[email protected]>:
> Hi, > > Catonano <[email protected]> writes: > > > in the NEWS file, I read: > > > > > > ... > > ** Removed function: `macroexpand-1' > > > > It is unclear how to implement `macroexpand-1' with syntax-case, though > > PLT Scheme does prove that it is possible. > > > > > > what's the problem with macroexpand-1 and syntax-case ? > > In Guile 1.x, 'macroexpand-1' performed a single macro expansion step at > the top-level form of an expression, using its old non-hygienic macro > expander. There are several problems with trying to provide such an > interface in a Hygienic macro expander, and especially in the > 'syntax-case' expander with its support for 'datum->syntax'. For one > thing, our modern macro expander doesn't even work with the plain > S-expressions which 'macroexpand-1' accepted and produced. It works > with "syntax objects", which effectively annotate every identifier with > extra information needed to determine which binding it references, and > also extra information needed to implement 'datum->syntax'. This in > turn requires detailed knowledge of the lexical environment in which > expansion is taking place, whereas 'macroexpand-1' provides no way for > the user to provide this information. > > Mark > I have been reading this document about the scheme higienic macros https://www.cs.indiana.edu/~dyb/pubs/bc-syntax-case.pdf I stopped reading it when I read that the implementation relies on a previously bootstrapped version of another macro expansion implementation. So I have a general overview of the issue But Racket has some facilities to step and debug macros, as you can see here https://docs.racket-lang.org/macro-debugger/index.html Aren' t Racket macros higienyc ? In this question I've been promptly suggested a quick solution to perform a single macro expansion step https://stackoverflow.com/questions/50073207/macro-expansion-in-guile-scheme/50515880#50515880
