3 ms·
No it is not. What's the point of a compiler if you check types at runtime? It's just that a lot of things in Go weren't carefully designed and now the price of
by aikah 8y ago
No it is not. What's the point of a compiler if you check types at runtime? It's just that a lot of things in Go weren't carefully designed and now the price of adding something to the language is the price of dealing with technical debt. For instance Go has a form of exception (panics), returning errors is purely a convention. But panics aren't very good at exceptions either.
- dana321 8y agoWell, what was the point of adding std::any in C++17? Generics aren't a cure-all, they merely duplicate code and change the type. Its not much better than copy-paste and replace the type names.
- aikah 8y ago> Generics aren't a cure-all, they merely duplicate code and change the type. Its not much better than copy-paste and replace the type names. Nobody ever said that. > . Its not much better than copy-paste and replace the type names. Yes it is. You let the compiler do the job, instead of doing it manually.
- dana321 8y agoOk, well i just said it, so somebody did. There is no difference whatsoever between the same function duplicated with different types.
- aikah 8y ago> Ok, well i just said it, so somebody did. Don't be obtuse, nobody ever said "Generics are a cure-all". > There is no difference whatsoever between the same function duplicated with different types. Yes there is, it's called polymorphism.