[plt-scheme] unitsig rename

From: Mike T. Machenry (dskippy at ccs.neu.edu)
Date: Sun Dec 1 15:14:50 EST 2002

I am trying to create a unit/sig mixin the imports a class foo% from the
signature foo^ and exports the signature foo^. I attempt this:

(require
 (lib "unitsig.ss")
 (lib "class.ss"))

(define-signature foo^ (foo%))
(define foo-embelishemts@
  (unit/sig foo^
    (import foo^)
    (rename [super% foo%])
    (define foo%
      (class super%
        (super-instantiate ())))))

The problem is that rename does not let me rename a variable that is
exported, even if it is defined elsewhere in the body. The error is:

unit/sig: signature "foo^" requires variable "foo%" renamed "super%"

I want to know if this is intended. If not can it be fixed easily and quickly?
If it is intended or cannot be fixed quickly, is there a good work around?
I came up with this:

(define foo-embelishemts@
  (unit->unit/sig
   (unit
    (import foo%)
    (export (foo-embellishments% foo%))
    (define foo-embellishments%
     (class foo%
       (super-instantiate ()))))
   (foo^)
   foo^))

This solution is in sufficient as it requires me to expand the signature
foo^ into foo% on the fourth line. This makes adding imports like
drscheme:tool^ all but impossible.

Thanks for the help
-mike


Posted on the users mailing list.