[plt-scheme] units

From: Tom Hirschowitz (tom.hirschowitz at inria.fr)
Date: Fri Oct 25 04:49:31 EDT 2002


I was trying to read Matthew's thesis about units [1], 
and wanted to check a bit of my understanding. 
I am not sure it is the place for posting such things, 
so please just tell me if not.

If I understand correctly, the Unit_d formalism presented in [1]
restricts MzScheme units on some points, which is a frequent thing, but
also seems to extend them on (at least) two points.

1. Linking mode : in Unit_d, linking is by name directly - as with
signed units, right? Anyway, that's not important.

2. Initialization expressions. In Unit_d, unit body clauses
are divided into definition and initialization clauses, and 
during composition, the initialization clauses of all arguments
are put in the end, after all definition clauses.
This does not seem to be done (nor specified) in MzScheme, as showed by 
the following code, which prints "#<undefined>#<undefined>".

Is that true, or am I lost?



(require (lib "unit.ss"))

(define A
  (unit (import x y)
        (begin (display x) (display y) 0)))

(define B
  (unit (import)
        (export x y)
        (define x 1)
        (define y 2)))

(define C
  (compound-unit (import)
                  (Sa (a (Sb x) (Sb y)))
                  (Sb (B)))

(invoke-unit C)


M. Flatt, "Programming languages for reusable software components",
PhD thesis, Rice U.

Posted on the users mailing list.