Thu Mar 24 20:59:55 EDT 2011

Unit unions

Let's just build and abstraction for it.  I don't think that compound
signatures are possible, except for the limited single-inheritance.

So I got something working:

(define-syntax (define-dictionary stx)
  (syntax-case stx ()
    ((_ name (sig^ ...))
     #`(define-syntax name #'(sig^ ...)))))

 (define (re-syntax context stx)
   (datum->syntax context (syntax->datum stx))))

(define-syntax (define/invoke-dictionary stx)
  (syntax-case stx ()
    ((_ dict^^ (unit@ ...))
     (let ((sigs (re-syntax stx (syntax-local-value #'dict^^))))
           (define-compound-unit/infer combined@
             (export #,@sigs)
             (link unit@ ...))
           (define-values/invoke-unit combined@
             (export #,@sigs)))))))

And then:

(define-dictionary pic18^^
   .. ))

This works, but only because the symbols are non-hygienic.  I can't
seem to keep the signatures themselves hidden, and export the