[plt-scheme] Unbound variable at unit signature

From: Stevie Strickland (sstrickl at ccs.neu.edu)
Date: Mon Feb 16 17:54:25 EST 2009

On Feb 16, 2009, at 3:00 PM, R. Emre Başar wrote:
> We are trying to develop an extension to DrScheme. We are stuck at
> defining some new signatures for our unit.
>
> The main problem is our application consists of multiple units, which
> need to be invoked by a controller unit. Currently, we are trying to
> define signatures for those units, but we are unable to accomplish it.
>
> When we try to invoke a function in another unit we get this error  
> which
> comes from the signature file:
>
> "expand: unbound variable in module"
>
> There is an example code at http://cs.bilgi.edu.tr/~reb/unit-example

Looking at your code, everything looks good except that you are  
attempting to invoke the client unit without linking it to the server  
unit.  When you do this, it can't find an appropriate version of echo,  
and so it fails.

One example of what you might do after defining the client@ unit is  
the following:

;; This links together the client and server units into one unit
(define-compound-unit/infer server+client@
   (import)
   (export)
   (link server@ client@))

;; This invokes the combined unit.
(invoke-unit/infer server+client@)

> On another topic, are there any tutorials on creating and using units.
> We are having trouble in some points, and although we read the
> documentation, we are not able to find any examples in it.

Yes -- I would suggest the Unit chapter from the Guide:

   http://docs.plt-scheme.org/guide/units.html

If you're running a 4.x version of PLT Scheme, you should have this  
installed locally as well.

HTH,
Stevie

Posted on the users mailing list.