5 ms·
FYI, Racket's syntax macros is from its Scheme roots. For further information on what Scheme provides, by standard revision: R5RS: [0] R6RS: [1] R7RS: [2] (P
by dleslie 10y ago
FYI, Racket's syntax macros is from its Scheme roots. For further information on what Scheme provides, by standard revision:
R5RS: [0]
R6RS: [1]
R7RS: [2] (Page 22)
And many Schemes provide non-standard extensions; for instance, Chicken supports non-hygienic macros[3].
FWIW, I prefer to think of the two stages as "syntax expansion" and "evaluation", and not "compile time" and "run time". Compilation and running are loaded terms that don't appropriately capture the totality of situations where this behaviour applies, in Scheme.
0: http://schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-8.html#%_sec_5.3 http://schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-8...
1: http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-14.html#node_sec_11.2.2 http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-14.html#node_se...
2: http://trac.sacrideo.us/wg/raw-attachment/wiki/WikiStart/r7rs.pdf http://trac.sacrideo.us/wg/raw-attachment/wiki/WikiStart/r7r...
3: http://wiki.call-cc.org/explicit-renaming-macros http://wiki.call-cc.org/explicit-renaming-macros
- ezyang 10y agoNote that R7RS does not really have any sort of sophisticated phase system for macros.
- hellofunk 10y agoWhat exactly is the difference between Racket and Scheme, how are they related?
- ioddly 10y agoRacket is derived from Scheme. Sometime after R6RS I believe they decided to just call their own not-necessarily compatible language Racket, but Racket can also run RxRS scheme code. http://racket-lang.org/new-name.html http://racket-lang.org/new-name.html
- nilved 10y agoRacket was formerly PLT Scheme, but it became such a superset of R6RS that it is now considered its own language. However, I believe it has options for Scheme compatibility.
- deleted 10y ago[deleted]
- brudgers 10y agoThe big differences in my experience are defaulting to immutability and embracing the idea of being a big language...so big that Racket is many languages, not just one.
- stchang 10y agoFWIW, the phase system that is the main topic of the article was created for Racket [1], though some Scheme macro systems have since adopted this Racket innovation. [1]: https://www.cs.utah.edu/plt/publications/macromod.pdf https://www.cs.utah.edu/plt/publications/macromod.pdf
- brudgers 10y agoRacket also has the concept of a documentation phase. Matthew Flatt wished it into existence when creating Scribble.
- dleslie 10y agoChibi[0] supports Scribble. :) 0: http://synthcode.com/scheme/chibi/lib/chibi/scribble.html http://synthcode.com/scheme/chibi/lib/chibi/scribble.html
- samth 10y agoI think it (like Guile) just supports the reader syntax, rather than the semantics (which is heavily based on Racket's macro system).
- madmax96 10y agoI strongly dislike Racket's macro system, from my admittedly limited usage of it. Does Racket have a way to address the need to, say, create a dispatching table during syntax expansion and read from that table at runtime? I don't know Racket well, but I've been able to do similar things easily in Guile, Common Lisp, and Clojure without an issue. Googling this problem leads me to believe that it can't be done, which is a pretty severe handicap to have if you're a Lisp.
- samth 10y agoYes, you can certainly do that in Racket. For example, the `case` macro does exactly that when there are many possibilities. Unless you mean something different that I mean by "create and then read from".
- madmax96 10y agoAh. It seems I have misunderstood some of the Racket documentation. Thanks for the comment -- helped me out:) Also adding that what I was doing in Guile, Common Lisp, and Clojure was sloppy. After searching for the case macro, saying 'aha!', and applying what I learned into creating an equivalent Racket macro, I realize that it was a portable solution to Guile, and the same idea applies for non-hygienic macro systems.
- gus_massa 10y agoIf you send a minimized example to the mailing list, I'm sure someone will translate it from Guile to Racket in a few hours. https://groups.google.com/forum/#!forum/racket-users https://groups.google.com/forum/#!forum/racket-users (If the example is not too long, perhaps you can paste it here.)
- spraak 10y agoThis is tangentially related but it seems like you might know - I heard something about a big vs small release of R7RS? Do you know anything about that?
- jdmichal 10y agoScheme has traditionally had a minimalist philosophy about the language itself. Basically, the language defines only very low-level syntax and operations -- think arithmetic, variable and function definition, basic control flow, etc. It was then up to libraries to add additional functionality. R7RS small maintains this same mentality. R7RS big is basically R7RS small with a large standard library.
- sitkack 10y agoR7RS would have to been an extraction, because big came first. That is probably the way to do things 1. kitchen sink 2. extract core 3. redefine kitchen sink as `small` + extras
- _delirium 10y agoAnd as political background, this is basically the "we'll offer both options" resolution to the R6RS acrimony. R6RS tried to take the language in a more "batteries included" direction, which led to a lot of resistance from some quarters, and was part of why Racket ended up disclaiming itself as being a Scheme and going in its own direction (the Racket team was quite involved in R6RS, and I believe stung by the way it was essentially rejected by a big part of the Scheme community). R7RS-small is sort of a spiritual successor to R5RS, and R7RS-large is trying to carry on what R6RS attempted, but in a way that can be factored out of R7RS-small and used to complement it. The problem people have been trying to work through is that many people like a small, clean, minimalist core Scheme, but many other people (well, some are the same people, myself included) don't think the current standard is enough to produce useful interoperability. Especially implementors like being able to write small self-hosted experimental or embedded Schemes without a large standard. But many people writing Scheme code are not all that happy about the poor interoperability story that ends up resulting, because there is not quite enough standardized to write libraries that will work on all the major schemes, which is why there's no Scheme equivalent of CL's Quicklisp repository of cross-implementation libraries (the SFRI system is the only real attempt to make this sort-of happen, and is not really good enough).