3 ms·
Sounds like type-assertions cover that use case just fine. However, you are correct that you can't do this without allocating. ¯\_(ツ)_/¯
by brandonbloom 10y ago
Sounds like type-assertions cover that use case just fine. However, you are correct that you can't do this without allocating. ¯\_(ツ)_/¯
- dbaupp 10y agoAs people keep saying, type assertions do not have as strong compile time assurances as ADTs.
- brandonbloom 10y agoAnd as I keep saying: I don't value those assurances and in fact find them to be a net loss when accounting for breaking changes changes to clients.
- dbaupp 10y agoYou personally not valuing the differences is very different to not having any differences, and the latter is what a lot of your comments seem to be implying, including the one I was replying to.
- codygman 10y agoYou pay the price of getting the bugs and edge cases out regardless of whether you have compile time assurances. The complexity is inherent and you can either choose to make it implicit and play the losing game of ensuring it doesn't fail with tests or make it explicit from the outset.