Putting identifiers in syntax properties causes them to be hidden from
various scope and module-path-shifting operations. Probably, you're
seeing the effect of hiding an identifier from path shifting (when an
expanded module is compiled or when a compiled module is declared and
instantiated in at a given module path and phase).

I'd like to have a better story for identifiers in syntax properties.
Meanwhile, when I have run into this problem, I've usually been able to
avoid it by putting the identifier in a `quote-syntax` form. That is,
instead of putting a 'my-info property on some expression

   e

I made a macro or other transformer generate

  (begin
   (quote-syntax (my-info <info>))
   e)

and a traversal of an expression looks for <info> in expressions that
match that pattern.

If that strategy doesn't work for you (without major changes to your
program), then I'm afraid I don't have a better answer at the moment.

At Tue, 25 Oct 2016 15:42:54 -0700, Alexis King wrote:
> In the language I am working on, I store identifiers in preserved
> syntax properties to attach type information to pieces of syntax.
> More specifically, I store identifiers inside prefab structs, which
> are then stored within preserved syntax properties. This seems to
> work fine when my program spans a single module, but it breaks in
> a confusing way when I use an identifier from another module.
> 
> Specifically, I have two identifiers from the “same” place, but the
> macro that attaches the syntax property is used in two different
> modules. I would expect these identifiers to be free-identifier=?,
> but they are not. Looking at what identifier-binding returns, I get
> the following results:
> 
>   (#<module-path-index:()> List #<module-path-index:()> List 0 0 0)
>   (#<module-path-index:(rascal/prelude)> List 
> #<module-path-index:(rascal/prelude)> List 0 0 0)
> 
> Obviously, the module path index values are different, but I don’t
> know why or how to fix it. My attempt to create a minimal reproducible
> test case led to me filing racket/racket#1495[1], but that issue
> seems to be slightly different from my problem.
> 
> If I stick an identifier in a preserved syntax property, what are
> the guarantees I have about it? Is using free-identifier=? on it
> from another module dangerous in some way? The documentation doesn’t
> seem to mention anything about this, but in the meantime, I’m
> honestly a little unsure how to even begin to fix this (aside from
> radically changing how my program works).
> 
> [1]: https://github.com/racket/racket/issues/1495
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to