[plt-scheme] duplicate structure types

From: Doug Orleans (dougo at place.org)
Date: Wed Mar 24 14:51:59 EST 2004

Matthew Flatt writes:
 > At Wed, 24 Mar 2004 01:48:53 -0500, Doug Orleans wrote:
 > > If I define a struct type in a module, then both require and
 > > require-for-syntax that module, then try to access at runtime a struct
 > > that was created at expansion time, I get an error like this:
 > > 
 > >   foo-bar: expects args of type <struct:foo>; given instance of a
 > >   different <struct:foo>
 > > 
 > > How can I make it so only one struct type get created?
 > You can't.
 > Arguably, the macro expander should not have let you wrap the structure
 > instance as a syntax object, preventing you from transferring it across
 > phases (i.e., preventing 3-D syntax).

I stored it in a syntax property of a syntax object, which I then
transferred to runtime with "#`(quote-syntax #,stx)".  I'm not
actually converting the structure itself into syntax, or is this the
same thing?  Is there a better way to make expansion-time info
available at run-time?

--dougo at place.org

Posted on the users mailing list.