3 ms·
Generics will be insanely useful for me. I work in an environment that uses a huge Golang KV store for all persistence. This means we write all of our own index
by woah 5y ago
Generics will be insanely useful for me. I work in an environment that uses a huge Golang KV store for all persistence. This means we write all of our own indexing code etc. None of it is reusable because of the lack of generics, so each module has much of the same boilerplate for building second indexes, etc, often written in slightly different styles because it was written by different people.
Generics will let us build a set of tools for DB access and indexing tools which can be reused across all types.
- maccard 5y agoWhy are generics more usable than codegen in that use case?
- vlowther 5y ago... writing the code required to write the code needed to implement indexes is more fragile than letting the compiler do it for you, most likely. I maintain a reflect-based indexing implementation for in-memory data, and look forward to seeing what I can do with generics to get rid of reflect based overhead.
- janderland 5y ago:shrug: I’ve tried doing it both ways in other languages and found that code gen is less fragile than I expected, though I needed to carefully consider the interface between generated & manually written code.
- woah 5y agoSomeone is working on an "ORM" that uses codegen from proto files, which we are already using for serialization. Not sure when it will be done. Compiler level generics are just a lot quicker and easier for anyone to use without requiring a whole code generation framework