I will take a look at this as well. It may be a few days before I have time 
to devote to this again, but I appreciate everyone's help so far.

-- Jonathan

On Wednesday, August 14, 2019 at 1:00:54 AM UTC-4, Matthew Butterick wrote:
>
>
> On 13 Aug 19, at 7:03 PM, Jonathan Simpson <jjsi...@gmail.com 
> <javascript:>> wrote:
>
> In the following magic code, a new function(called a named query in magic) 
> tga-image is defined and later used inside the definition of the function 
> test-scope. The issue is that tga-image is an unbound identifier in 
> test-scope. If tga-image is used outside of a function there isn't a 
> problem because the syntax object passed to use has the binding. What I 
> would like to do is define tga-image at the top level.
>
>
>
>
> You might consider the technique described here, including the 
> `find-unique-var-ids` function:
>
> https://beautifulracket.com/basic-2/variables-and-input.html
>
> Since you're using `brag`, you can wrap your future identifiers in, say, 
> an `id` rule that you splice away in the grammar. So your parse tree ends 
> up the same, but now that `id` rule leaves a residue as a syntax property. 
>
> Then, as part of your `#%module-begin` prep work, you can use this 
> property to pull out the identifiers and write them into the top level of 
> your new module as `define` expressions (with dummy values, that would get 
> replaced later with `set!`). 
>
> There may be a way of accomplishing the same thing more elegantly with 
> syntax lifts and captures. Like the lost city of El Dorado, I searched for 
> this beauty, but expired on the jungle floor before discovering it. Since 
> then, however, many people smarter than me have seen that page, so by 
> Cunningham's Law, if there were a better method, I probably would've been 
> told by now. 
>
>
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/49dc585e-270b-449a-b5dd-30d1293a9127%40googlegroups.com.

Reply via email to