Can you avoid using Base.invokelatest in this example?

@stevengj thanks for your kind reply! They are really useful. I have further comments.

Yes, for me this was also a good approach, but I was not sure that all unknown symbols should be transformed to params.symbol_name in the general case (for the example I posted this is true). I mean, the provided expression a * b * c * μ * X could be really different and involve many things (I think I had previously think of an example where this was not true).

Yes, everyting is prepared to run with named tuples or structs (using the same macro @with_kw in Parameters.jl).

I will think about this

A post was split to a new topic: How can a macro create functions that are handled at compile time?