[plt-scheme] MzLib's unitsig.ss

From: John Clements (clements at brinckerhoff.org)
Date: Tue Jan 21 13:45:38 EST 2003

On Monday, January 20, 2003, at 05:37 AM, Noel Welsh wrote:

>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> --- Taylor Campbell <campbell at evdev.ath.cx> wrote:
>> Is it possible to use macros in a unit/sig?
>
> Units are run-time values.  Macros are expansion-time
> values.  Expansion-time occurs before run-time; hence
> units cannot export (or import) macros.  However units
> can use macros defined in the enclosing module.

Just to add to this, macros _can_ be provided (a.k.a. exported) from 
modules.  In many ways, this is the raison d'etre of the module system. 
So, if your goal is to make a single macro available in many different 
pieces of code, you can place its definition in a module which is 
required in all those places.

As a nice example of this, the unit and unit/sig language forms are 
themselves macros, provided by the "unitsig.ss" module.

john clements



Posted on the users mailing list.