[plt-scheme] macros for unit/sig

From: Benderjg2 at aol.com (Benderjg2 at aol.com)
Date: Sun May 25 23:30:26 EDT 2003

In a message dated 5/25/2003 5:55:35 PM Central Daylight Time, 
dherman at ccs.neu.edu writes:

> I'm learning a few things at once here, so please forgive any 
> muddle-headedness... I'm having some trouble defining macros that 
> generate unit/sig.

In the same spirit, my example below puzzles me...
This (toy) macro defines a signed unit form that has an export signature, 
but no imports. It is supposed to generate a signed unit with an empty 
import list. The macro looks like it "ought" to work--but doesn't.

(require (lib "unitsig.ss"))

(define-syntax bad-unit
  (syntax-rules ()
    ((_ export-sig . body)
     (unit/sig export-sig (import) . body))))

(define-signature test^ (get set tick))
(define test@
  (bad-unit test^
     (define xx 0)
     (define (get) xx)
     (define (set n) (set! xx n) xx)
     (define (tick) (set! xx (+ xx 1)) xx)))

The result is an error message:
  unit: exported variable is not defined in: get

Is this some subtle hygiene problem?

Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20030525/d6d4d6be/attachment.html>

Posted on the users mailing list.