[plt-scheme] Re: let-values/invoke-unit?

From: Paulo J. Matos (pocm at soton.ac.uk)
Date: Thu Mar 8 18:15:05 EST 2007

So, after a some minutes testing the compound-unit approach I got to
draft code which does what I want:
(define-signature hello^ (val prt))

(define-unit hello@
  (import)
  (export hello^)
  (define val 'hello)
  (define prt
    (lambda (x) (format "I said bye. ~a~n" x))))

(define stable (make-hash-table))

(define-unit register@
  (import hello^)
  (export)

  (hash-table-put! stable val prt))

(let ((a-unit hello@)
      (register-unit register@))
  (invoke-unit (compound-unit
                 (import)
                 (export)
                 (link (((HELLO : hello^)) hello@)
                       (() register@ HELLO)))))


My question is then, if this is the best approach for function
registering, is there a simpler way to do this? This question derives
from the fact that the new unit system has some new stuff (which I
haven't had the time to look at, yet) described in 53.4, 53.5 and
53.6. Should I look in to any of these urgently or they don't help me
much in this case?

Cheers,

-- 
Paulo Jorge Matos - pocm at soton.ac.uk
http://www.personal.soton.ac.uk/pocm
PhD Student @ ECS
University of Southampton, UK


Posted on the users mailing list.