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

From: Kyle Smith (airfoil at bellsouth.net)
Date: Mon Dec 25 22:16:29 EST 2006

Danny Yoo <dyoo at ...> writes:

> 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.


Thanks for the Xmas gift.  I certainly didn't expect it.

BTW, when I changed the plt-pretty-big-text.ss to use unit.ss and took out the 
old references, as you indicated, and then did an mzc --make plt-pretty-big-
text.ss, everything went smoothly and the .zo was created.  However, when I 
restarted DrScheme (cool little easter-egg they've got today), it crashed 
after everthing was loaded.  So I reverted plt-pretty-big-text.ss, and now all 
is well.  In addition, it doesn't seem to bother the proper functioning of 
this little piece of code, because the following works under pretty-big:

(module pp-sig mzscheme
     (provide pp^)
     (require (lib "unit.ss"))
     (define-signature pp^ (data)))

(module pp (lib "a-unit.ss")
     (require pp-sig)
     (import pp^)

     (define (pp x)
       (display x)
     (pp data))

(require pp)
(require pp-sig)
(require (lib "unit.ss"))

(define data 'success!)
(invoke-unit pp<at> (import pp^))

Welcome to DrScheme, version 369.2-svn21dec2006.
Language: Pretty Big (includes MrEd and Advanced Student).

I think the glitch was that I spaced, and hadn't required pp-sig and unit.ss 
at top-level, as you pointed out.  Perhaps I got that strange error message 
when not having required the new unit.ss, it defaulted to the old unit code, 
which comes already required into pretty-big.  However, it seems, if you do 
things properly, having the old requires in the language doesn't break the 
function of the new unit code, at least not in this small example.

Anyway, I very much appreaciate your help on this holiday.  Someday I hope I 
can return the favor.


airfoil at bellsouth dot net

Posted on the users mailing list.