[plt-scheme] units and (export (rename ...))
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