Possible brewRec improvement #11
Replies: 2 comments
-
Hi @coreywoodfield. |
Beta Was this translation helpful? Give feedback.
-
Hi @coreywoodfield, I've finally got some free time to implement the idea I was talking about.
and then calls for recursive brewing |
Beta Was this translation helpful? Give feedback.
-
I don't know how feasible this would be. But I think it'd be really cool.
brewRec
is super convenient, but I hesitate to use it for anything serious because of how easy it would be to misuse. If you want to create at most one instance of anything, you need to manually brew anything that is used by multiple things.Example: with the following class definitions,
the following usage of the macro
currently creates something like
It'd be really nice if it could instead create something like
Would something like this be feasible? I'm guessing it wouldn't be possible without changing how the macro is invoked. Maybe
brewRec
could take a list of types to instantiate, and it could create fields for each of them and all their dependencies? Just an ideaBeta Was this translation helpful? Give feedback.
All reactions