[plt-scheme] Macro expanding into define-values/invoke-unit?

From: Anthony Cowley (acowley at seas.upenn.edu)
Date: Mon Jul 13 01:29:21 EDT 2009

On Sun, Jul 12, 2009 at 10:57 PM, Matthew Flatt<mflatt at cs.utah.edu> wrote:
> The `foo^' signature introduced by the macro acts like a binding
> identifier introduced by a macro: It doesn't bind other identifiers
> unless they are introduced by the same macro expansion.
>
> One solution is to provide the signature name, so that it isn't
> introduced by the macro:
>
>  (define-syntax mkfoo
>   (syntax-rules ()
>     [(_ x foo^) (define-values/invoke-unit x (import) (export foo^))]))
>
>  (mkfoo foo@ foo^)

Ah, so when the signature is expanded into the identifiers for the
define-values form, they are given the lexical context of the
signature?

This was all an endeavor to trim some slightly verbose unit invocation
syntax. When supplying a parameter for a unit, I seem to have several
options: In the following examples, our indefatigable unit foo@
requires an input of setup^ and exports foo^... and this email got far
too long to bother those who are not interested. I've collected
insights from the list into a blog posting here
<http://www.arcadianvisions.com/blog/?p=135>.

Thank you all for the help!

Anthony


Posted on the users mailing list.