[plt-scheme] compound unit duplicate names...prefix?
I've been trying to figure out units and I'm puzzled about the naming
between units. I made for instance a "keys" unit that exports a few
procedures, a procedure named 'save' and a procedure named 'load' for
saving and loading keys. A "basic" unit that also exports a different
save and load procedure, and a "decider" unit that also exports a
different save and load procedure.
The trouble comes when I make a compound unit with
(define-compound-unit/infer). It can link together the above units just
fine, and export decider^ perfectly well, but if I were to say export
keys^ and decider^ it would fail, because both keys^ and decider^
signatures have a "save" procedure and a "load" procedure. I would
export (except keys^ save load) since the keys unit has useful
procedures besides that save and load, or I would export (prefix keys:
keys^) so anyone importing my compound unit could use key:load when they
wanted specifically to load a key. But neither of those methods work,
because the export syntax for define-compound-unit/infer will not allow
(except ...) or (prefix ...) only the signature IDs as they are named.
My solution has been to use names such as keys:load-key and
basic:load-basic, but that seems redundant to me. I much prefer putting
a prefix on to avoid namespace conflict, than to have a required -X
suffix that I write into the unit definition itself. Is there a more
elegant method? Or is that just what I have to do, for the name of every
load or save procedure append a special suffix indicating what unit it's in?
I'll attach an example... when I try to run test.ss I predictably get
the error "define-values/invoke-unit/core: duplicate binding for foo in:
(define-values/invoke-unit/core both@ a^ b^)"
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: a-sig.ss
URL: <http://lists.racket-lang.org/users/archive/attachments/20090809/bc29c74f/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: a-unit.ss
URL: <http://lists.racket-lang.org/users/archive/attachments/20090809/bc29c74f/attachment-0001.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: b-sig.ss
URL: <http://lists.racket-lang.org/users/archive/attachments/20090809/bc29c74f/attachment-0002.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: b-unit.ss
URL: <http://lists.racket-lang.org/users/archive/attachments/20090809/bc29c74f/attachment-0003.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: c.ss
URL: <http://lists.racket-lang.org/users/archive/attachments/20090809/bc29c74f/attachment-0004.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.ss
URL: <http://lists.racket-lang.org/users/archive/attachments/20090809/bc29c74f/attachment-0005.ksh>