raoul.schorer
2021-3-23 09:45:47

I’m creating a serializable-struct inside a lambda (used to configure the struct at runtime). This fails with module+: allowed only in a module body in: (module+ deserialize-info... . Looking at the macro stepper, there is indeed a module+ form that gets expanded in the body of the lambda. Is there a way around to configure a serializable-struct at runtime?


laurent.orseau
2021-3-23 09:57:34

I’m only guessing here, but this sounds like the definition of the struct needs to be lifted to the module level. This may require creating the struct inside a macro that uses https://docs.racket-lang.org/reference/stxtrans.html?q=lift%20expression#%28def._%28%28quote._~23~25kernel%29._syntax-local-lift-expression%29%29\|syntax-local-lift-expression


laurent.orseau
2021-3-23 10:30:44

Of course if you need to create multiple structs with the same names that will probably be a problem


raoul.schorer
2021-3-23 10:35:28

I’ll report back if I get stuck. But I think it should work. Thank you! :grinning: