4 ms·
I’m curious, has anyone here had an actual need for genetics in production code? I mean, like you actually have an uncountable or at least large number of types
by erikpukinskis 7y ago
I’m curious, has anyone here had an actual need for genetics in production code? I mean, like you actually have an uncountable or at least large number of types that you want to push through a generic mechanism?
I use “generics” in TypeScript but it’s always a very small number of types: usually two, maybe up to 10...
There’s no reason I couldn’t do that without generics, just by writing a couple line plugin for each type that converts it to a common representation.
I’m not convinced that’s even strictly worse than generics from a usability perspective.
- snagglegaggle 7y agoYeah. The usual case is a container type or composing with a container type, but there are many "algebraic" types that you may wish to use if they could accept types to parametrize them over.
- vmchale 7y agoI wrote a blog post about an example that came up for me: http://blog.vmchale.com/article/ats-templates http://blog.vmchale.com/article/ats-templates