On Tue, 24 Feb 2009, Sam TH wrote:

On Tue, Feb 24, 2009 at 6:03 PM, John Cowan <[email protected]> wrote:
Tangent: Can someone explain to me what the merit is in being able to
reference macros before they are defined in *any* context?  Perhaps there
is one, but I don't see it.

If you define a macro to that simulates a value definition form with a
macro definition form (this is what my `define-inline' example does,
using `syntax-rules'), then you would probably want to have mutual
recursion among these definitions be possible.

This might be a bit of expressiveness in the macro system that could
be given up at the REPL, though.

Well, not that much expressiveness.  You can fix your example

 (import (rnrs))

 (define-syntax definline
    (syntax-rules ()
      [(_ (n . args) body)
       (define-syntax n
          (syntax-rules ()
             [(_ . args) (lambda () body)]))]))

 (definline (even-printer n) (if (even? n) ((print-even n)) #f))
 (define p (even-printer 12))
 (definline (print-even n) (begin (display n) (display " is even")))

to be workable in a REPL by simply exchanging the last two lines.

_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to