<p dir="ltr">Ah, now I know what I was doing wrong. I was using identifier-binding for references, but not for definitions. Now that I'm using it in both places, things seem to work.</p>
<p dir="ltr">Thanks!<br>
Sam</p>
<div class="gmail_quote">On Jul 17, 2014 3:08 AM, "Matthew Flatt" <<a href="mailto:mflatt@cs.utah.edu">mflatt@cs.utah.edu</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Does `identifier-binding` not give you the symbol that you need?<br>
<br>
At Wed, 16 Jul 2014 23:32:46 -0400, Sam Tobin-Hochstadt wrote:<br>
> Ok, I thought I had figured this out, but I was wrong.<br>
><br>
> Here's what I want to be able to do:<br>
><br>
>  - take an identifier in a fully-expanded source file<br>
>  - translate that identifier to some symbol in a predictable way<br>
>  - so that other references to that same (free-identifier=?)<br>
> identifier get translated to the same symbol<br>
><br>
> It's pretty easy to do this in a single module -- just keep a<br>
> free-id-table of all the identifiers mapping to gensyms. But I want to<br>
> be able to do this across modules, and across invocations of this<br>
> program. IOW, when I run my program on one source file, I'd like to<br>
> get a symbol for a provided definition that's the same symbol I get<br>
> when I run my program on a different source file containing a<br>
> reference to that definition.<br>
><br>
> Clearly this is possible, since Racket manages, but is there a way<br>
> that I can do it?<br>
><br>
> Sam<br>
><br>
> On Wed, Jul 16, 2014 at 7:55 AM, Matthew Flatt <<a href="mailto:mflatt@cs.utah.edu">mflatt@cs.utah.edu</a>> wrote:<br>
> > Yes, it can be ".2", etc. The numbers are generated as needed to create<br>
> > distinct names --- deterministically for a given module compilation,<br>
> > assuming that all macros used by expansion are deterministic.<br>
> ><br>
> > At Wed, 16 Jul 2014 07:36:50 -0400, Sam Tobin-Hochstadt wrote:<br>
> >> Does that mean that I can/should just drop the .1 to get the defined name?<br>
> >> Can it also be .2 etc?<br>
> >><br>
> >> Sam<br>
> >> On Jul 16, 2014 4:34 AM, "Matthew Flatt" <<a href="mailto:mflatt@cs.utah.edu">mflatt@cs.utah.edu</a>> wrote:<br>
> >><br>
> >> > That `posn1.1` is a unreadable symbol that stands for the symbol<br>
> >> > `posn1` plus some marks that distinguish it.<br>
> >> ><br>
> >> > In other words, `posn1.1` bridges (in an ugly way) the symbol-based<br>
> >> > world of module environments and the identifier-based world of syntax.<br>
> >> > In the future, I hope to shift module environments to be<br>
> >> > identifier-based to avoid these unreadable symbols.<br>
> >> ><br>
> >> > At Tue, 15 Jul 2014 09:10:26 -0400, Sam Tobin-Hochstadt wrote:<br>
> >> > > If you take this program and fully-expand it in the macro stepper:<br>
> >> > ><br>
> >> > > #lang racket<br>
> >> > > (struct posn (x y))<br>
> >> > > (define p1 (posn 1 2))<br>
> >> > ><br>
> >> > > You see that the residual program has an application of the `posn1`<br>
> >> > > function, which is the hidden constructor. And indeed, the<br>
> >> > > fully-expanded program has a definition of `posn1`. However, if you<br>
> >> > > click on the use of `posn1`, the macro stepper will tell you that it's<br>
> >> > > defined in this module as `posn1.1`, and provided as `posn1.1` as<br>
> >> > > well. If you write program to grovel through the fully-expanded<br>
> >> > > syntax, you get these same results as the `src-id` and<br>
> >> > > `nominal-src-id` from `identifier-binding`.<br>
> >> > ><br>
> >> > > Why is this? And is there a way to get from `posn1.1` to `posn1`<br>
> >> > reliably?<br>
> >> > ><br>
> >> > > Sam<br>
> >> ><br>
</blockquote></div>