[plt-scheme] units and (export (rename ...))

From: Chongkai Zhu (czhu at cs.utah.edu)
Date: Mon Dec 24 12:05:45 EST 2007


Dave Herman wrote:
> Why doesn't the following work?
>
>   (define-signature sig^
>     (operation))
>
>   (define (make-sig op)
>     (unit
>       (import)
>       (export (rename sig^ [op operation]))))
>
> Obviously the workaround is:
>
>   (define (make-sig op)
>     (unit
>       (import)
>       (export sig^)
>       (define operation op)))
>
> Is it fundamental to units that you can only export things that are 
> explicitly defined inside the units, or is it possible this could be 
> relaxed?
>
> Thanks,
> Dave
>

There is "unit-from-context", which doesn't have such restriction. But 
unit built with "unit-from-context" doesn't import anything, and can 
only export one signature.

(define-signature sig^
  (operation))

(define (make-sig op)
  (unit-from-context
   (rename sig^ [op operation])))

-
Chongkai



Posted on the users mailing list.