Skip to content
Felix S. Klock II edited this page Jul 28, 2013 · 1 revision

YouWantItWhen refers to Matthew Flatt's design for a module system that supports macros in a manner such that the interpreter and compiler agree on the semantics of the code you're executing.

This is a problem for a language with macros (even just syntax-rules) because you need to ensure the compiler knows about what macro definitions the code that you're compiling expects to have in place.

Its an even bigger problem for a language with a procedural macro system (such as syntax-case) because you may want to use macros in the code that you write to define macros; so how do you settle the compile-time versus run-time in that case? For Matthew's answer, read the Paper.


I have put some sketchy code for implementing YouWantItWhen style macro import for SRFI-55 in the comments and attachments for Ticket #56.

  • To be fair, the stuff with Ticket #56 isn't really the full-fledged YouWantItWhen system, because it does not attempt to construct a tower of phases. That is, it isn't providing PLT Scheme style require-for-syntax. Instead, it is merely providing Chicken style require-for-syntax (which is something entirely different from what PLT Scheme provides).

Here is an illustrative example I posted to the larceny-users mailing list.


% cat test.sch
(require 'srfi-8)

(define (successor x) (values x (+ x 1)))

(receive (y z) (successor 3)
  (display (list y z))
  (newline))
% /usr/local/bin/larceny
Larceny v0.93 "Deviated Prevert" (Nov 10 2006 04:27:45, precise:BSD Unix:unified)


> (load "test.sch") ;; works as expected
(3 4)

> (exit)
% /usr/local/bin/larceny
Larceny v0.93 "Deviated Prevert" (Nov 10 2006 04:27:45, precise:BSD Unix:unified)


> (compile-file "test.sch" "compiled1.fasl") ;; oops wrong syntax env

> (load "compiled1.fasl")


Error: environment-get-cell: denotes a macro: receive
Entering debugger; type "?" for help.
debug> a
% /usr/local/bin/larceny
Larceny v0.93 "Deviated Prevert" (Nov 10 2006 04:27:45, precise:BSD Unix:unified)


> (require 'srfi-8)
#t

> (compile-file "test.sch" "compiled2.fasl") ;; syntax env is appropriate this time

> (load "compiled2.fasl")
(3 4)

> (exit)
%
Clone this wiki locally