I have a solution to this problem — is it legit, or is there some slick Rackety technique I'm missing?
I'm making a toy #lang interpreter for Basic, which allows variables to be created with an assignment statement (like Python). The wrinkle in Basic is that the execution order of the lines isn't known till runtime, so there's no way to identify the "first" use of a variable and change it from a `set!` to a `define` (e.g., by testing `identifier-binding`) To fix this, I gather a list of variable identifiers from the parsed AST, insert the `define`s at the top of the `#%module-begin`, and then the rest of the AST, and the expander proceeds. That works. But it seems like the gathering of variables should be able to happen as the expander encounters them in the code (ie., do everything with one pass rather than two). The problem is that by the time all the variables have been discovered & gathered, the expansion is done, so AFAICT I can't go back and `define` them retroactively. -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

