[plt-scheme] multiple units with identical signatures

From: Synx (plt at synx.us.to)
Date: Mon Nov 2 18:31:35 EST 2009

Supposing there's a type of module that produces a "responder" procedure
for a servlet let's say (web-server/dispatch is what I was thinking).
I'll end up having some sort of "top" unit that imports all the other
units (with prefix) and exports a way to start them all up as a
web-server. Seems sensible, but when I try to implement it I have
insufferable difficulty.

If two units have the same signature, I don't see how I could import
them both. If two units have identical signatures, by different names,
that seems to work, but it fails on linkage.

So I'll have like:

page-sig.ss
----------------
#lang scheme/signature

respond
----------------

info-sig.ss
----------------
#lang scheme/signature

respond
----------------

top-sig.ss
----------------
#lang scheme/signature

run
----------------

top-unit.ss
----------------

...

(import (prefix page: page^) (prefix info: info) ...)

(define (run)
...
 (dispatch-rules
    (("~page" (integer-arg)) page:respond)
    (("~info" (integer-arg)) info:respond))
...
----------------

main.ss
----------------

...

(define-compound-unit/infer together@
  (import)
  (export top^)
  (link page@ info@ top@))

(define (main)
  (define-values/invoke-unit/infer together@)
  (run))
(provide main)
----------------



When I call main, and invoke the together@ unit, it errors out with the
mysterious message:

"context expected 1 value, received 2 values: #<procedure> #<procedure>"

How do I do this sort of thing, where a number of different units all
follow the same pattern and export the same symbols?


Posted on the users mailing list.