|
|
|
|
|
by bogaczio
3449 days ago
|
|
I would say that as long as you have a small enough number of types where implementing this for each of them (and each combination of them) is manageable... you should. The absolute worst thing about this is losing type safety (and I helped write it). The time to use this is IF this kind of design could simplify your code overall AND the number of types and their combinations is simply too much to code. Say you have four input types, two intermediary types, and one output type, and more than one step in between them, then you'd be writing about 15 times the code. We actually had a situation like this, which is why it came in handy. If you're not in this situation though, I would always advocate retaining type safety. |
|