I am defining a macro in a rhombus module that produces legal shplait syntax and is intended to be accessed by a module written in shplait.
What is the most direct and/or preferred way to associate the shplait language module's lexical information with the produced syntax object so that its bindings (particularly for implicit forms) resolve to those exported by shplait during expansion?
You could locally import and open shplait around the compile-time definition of stx. That way, shaplit is in the environment of 'add1(42)'. I'm using meta -1 here to reverse the phase shift from being inside meta:
#lang rhombus/and_meta
meta:
import:
meta -1: shplait open
def stx = 'add1(42)'
expr.macro 'add1_42': stx
export add1_42
Using 'add1(42)'.replace_scopes('sub1') doesn't help, because 'add(42)' and 'sub1' both have the same environment / scopes.
If you really just wanted add1, then you could more simply use