[plt-scheme] Help making a unit from a module

From: Danny Yoo (dyoo at hkn.eecs.berkeley.edu)
Date: Mon Dec 25 00:06:33 EST 2006

> invoke-unit: result of unit expression was not a unit: (make-unit ...)
> Does someone know the magic sequence in order to make this work.  I know 
> it's possible, because that's what a-unit.ss is all about.  I'm just 
> missing something in the implementation.

Hi Kyle,

Wait, there's something funny here.  I can duplicate the problem you see 
if I do this from the Pretty Big language in DrScheme.  Ok... checking...

Ah!  Ok, the problem is that Pretty Big is still using the old unit200 
system; it doesn't appear to have been updated to use the new unit system.

Once I make the following changes to pretty-big:

mithril:~/local/plt/collects/lang dyoo$ svn diff
Index: plt-pretty-big-text.ss
--- plt-pretty-big-text.ss      (revision 5065)
+++ plt-pretty-big-text.ss      (working copy)
@@ -4,8 +4,7 @@
            (lib "file.ss")
            (lib "list.ss")
            (lib "class.ss")
-          (lib "unit200.ss")
-          (lib "unitsig.ss")
+          (lib "unit.ss")
            (lib "include.ss")
            (lib "defmacro.ss")
            (lib "pretty.ss")
@@ -21,8 +20,7 @@
            (all-from (lib "file.ss"))
            (all-from (lib "list.ss"))
            (all-from (lib "class.ss"))
-          (all-from (lib "unit200.ss"))
-          (all-from (lib "unitsig.ss"))
+           (all-from (lib "unit.ss"))
            (all-from (lib "include.ss"))
            (all-from (lib "defmacro.ss"))
            (all-from (lib "pretty.ss"))

then your program will run fine (as long as you also do the proper require 
for pp-sig.ss).  I just don't know if Pretty Big is intentionally set up 
this way for legacy reasons, or if this was just omitted by accident.

The the real issue is that there are some parts that haven't been migrated 
over to the new unit system: what you were seeing was that the 
'invoke-unit' that you were running was unit200's: it was expecting to see 
an old-style unit, and that's why it gave you that peculiar error message.

Posted on the users mailing list.