[plt-scheme] multiple units with identical signatures

From: Synx (plt at synx.us.to)
Date: Mon Nov 2 23:23:11 EST 2009

Whoops! Unfortunately this example works fine:
----------------
#lang scheme/base

(require scheme/unit)

(define-signature page^ (respond))
(define-unit page@
  (import)
  (export page^)
  (define (respond) "I'm a page!"))

(define-signature info^ (respond))
(define-unit info@
  (import)
  (export info^)
  (define (respond) "I'm informative!"))

(define-signature top^ (run))
(define-unit top@
  (import (prefix page: page^)
          (prefix info: info^))
  (export top^)
  (define (run x)
    (cond
      ((string=? x "~page") (page:respond))
      ((string=? x "~info") (info:respond))
      (else (error "Couldn't dispatch" x)))))

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

(define (main)
  (define-values/invoke-unit/infer together@)
  (cons (run "~page")
        (run "~info")))
----------------

So my problem is decisively not with the units being unable to infer
each other's signature, identical or not. I should have tested that
before posting, sorry. I think it had something to do with... meh, not
sure. All I know is when I invoke the compound unit I get the error
{context expected 1 value, received 2 values: #<procedure>
#<procedure>"} with no stack trace. Something about... parameters maybe?
I know I've run across this before, it's so familiar...


Posted on the users mailing list.