On Friday, August 18, 2017 at 12:47:45 AM UTC-4, Sam Waxman wrote:
> I've recently run into some ambiguous identifier errors while writing a 
> reader, and I'm not sure how to solve them.
> 
> The situation is as follows:
> 
> I've created a version of "let" in one file. I'd like my reader to call it 
> whenever the user types something like
> 
> a = 3
> body ...
> 
> which should be read and turned into
> 
> (my-let ([a 3]) body ...).
> 
> But the way I'm currently doing things, if the user types
> 
> my-let = 3
> b = 2
> body ...
> 
> which expands into
> 
> (my-let ([my-let 3]) (my-let ([b 2]) body ...)),
> 
> Racket isn't sure which my-let to use for the third my-let in the line above. 
> It throws an ambiguous identifier binding error.
> 
> What's the correct way to use readers/namespaces so that the pattern id = 
> binding always turns into the let I defined in another file, but if the user 
> ever types "my-let" as an identifier, it never refers to the let I defined in 
> the other file?

On a related note, I've read that read-syntax is supposed to return a 
syntax-object whose lexical context is stripped. Why is that? Doesn't that make 
it impossible for the language to know the difference between the let I used in 
an earlier file and the let that the user types as an identifier?

-- 
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