3 ms·
Googling about this (I assumed the actual 'solution' would be a to use C-style awful macro kludges) eventually lead me to: https://blog.golang.org/generate htt
by bee_rider 6y ago
Googling about this (I assumed the actual 'solution' would be a to use C-style awful macro kludges) eventually lead me to:
https://blog.golang.org/generate https://blog.golang.org/generate
Now I'm wondering if you joke was not actually a joke.
- pjmlp 6y agoThis is how C++ compilers used to work before templates came into the picture. For example Borland's BIDS 1.0 in Borland C++ for MS-DOS, it was based on the C pre-processor, as you would define a set of macros and then include the desired type, something like #define LIST_T int #include <bids/list.h> #define LIST_T float #include <bids/list.h> and so on, however when BIDS 2.0 was released, there was already primitive support for the ongoing ISO discussions and it was rewritten to use templates. To be fair, Go generics seem to be finally on their way to be adopted into the language.
- xmprt 6y agoWe have a lot of codegen in our codebase right now and I can't wait for the day that generics are finally added.
- pjmlp 6y agoAs heavy critic, but also fan, I have been following up on it, and the last update on the document is from September, so I am positive they might make it, it just appears the proper implementation still has some engineering challenges. https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md https://go.googlesource.com/proposal/+/refs/heads/master/des...
- Joker_vD 6y agoWell, and there is also kinda sorta support foir generics on top of it: https://github.com/vasilevp/aboriginal https://github.com/vasilevp/aboriginal There is no engineering challenge that can't be overcome by ingenious thought!