[plt-scheme] A dummy syntax context
At Wed, 1 Sep 2004 16:47:09 -0400, "Mike T. Machenry" wrote:
> I am trying to make a readable<%> snip% exapand to a define using an
> identifier found within the snip%'s text%. To do this I a using
> symbol->string on the contents of the text% and then datum->syntax-object
> on the resultant symbol. The problem I am having, however, is that I need a
> syntax context (color) for datum->syntax-object. Normally, one would just
> use something like #'dummy for the context, however, being that the syntax
> is an identifier being defined, drscheme complains with:
>
> define-values: identifier for a top-level definition already has a module
> context in: foo
>
> Where foo is the symbol I am converting to a syntax-object and using in a
> define.
>
> I am calling datum->syntax-object from within the module that provides my
> snip, so it is getting that module's context. I don't know how to take the
> context out of the syntax object.
Do you need a context for this particular identifier? Most identifiers
produced by `read' have no lexical context. In this case, it sounds
like you should use #f for the context argument to
`datum->syntax-object' so that the identifier will have no context.
Matthew