[racket] Testing macro helpers

From: Eric Dobson (eric.n.dobson at gmail.com)
Date: Sun Apr 7 01:24:55 EDT 2013

I am trying to test a helper to a macro. It generates a syntax object
with bindings at phase-1, this is then returned by the macro and it
correctly evaluates. Is there a way to not go through the macro, but
still evaluate the syntax-object with those bindings it has at phase-1
relative to the helper and not phase 0 relative?

Example code:
#lang racket/load

(module t racket
  (provide (all-defined-out))
  (define temp 7))

(module stx-compute racket
  (provide (all-defined-out))
  (require (for-template 't))
  ;(require 't)
  (define (compute) #'temp))


(module stx racket
  (provide (all-defined-out))
  (require (for-syntax 'stx-compute))
  (define-syntax (use-compute stx)
    (compute)))

(require 'stx)
(displayln (use-compute))
(require 'stx-compute)
(displayln (eval-syntax (compute)))

This fails on the eval-syntax, but succeds if I uncomment the (require 't).

Posted on the users mailing list.