Please correct me if I’m wrong, but I think that there doesn’t exist a safe language that has this capability, and if a language does have this capability it isn’t really safe.
One could encode an entire language via expressions inside of data Value
, the way @cocreature does here Functions - Can we pass them as arguments in a choice? - #2 by cocreature.
I interpret @Andrae’s example to demonstrate that the parametericity you need probably depends on what you intend to do with your templates. So you could have generic choices. But if you’re looking for a mechanism to avoid repeating share state can you have a generic data type that has a specific instance on each template?
Barring a good example, I don’t think that exposing the Any
type is a good solution. Who would want to sign such a contract? I’m not certain that it provides the mechanism that you’re looking for, (something akin to Data.Dynamic?) Even if you were to have that you’ll still have to compile the lookup.