Closed fonsp closed 3 years ago
I think this raises the question of whether we should macroexpand
the struct body before feeding the expression into option codegen
s, the answer is probably a no since it's very likely that one wants to use a macro to further extend the syntax inside a JLKwStruct
syntax, e.g I did this to support custom validation in https://github.com/Roger-luo/KungIChi.jl
So I think the solution is probably only special case the @static
macro. I need to think about this a bit.
OK I think we should do macroexpand
for @option
since @option
aims to be the same with Base.@kwdef
but the macroexpand
only happens in option_m
thus whoever do not want macroexpand
can still use Configurations' advance codegen feature to implement their own compatible option types.
While trying to port Pluto to Configurations.jl, I found this:
We use
@static
here: https://github.com/fonsp/Pluto.jl/blob/main/src/Configuration.jl#L84