3 ms·
Don't know Fortran, but while C doesn't have generics you're getting similar behavior due to macros (for example min(), max() are macros) and weak typing. So th
by takeda 7y ago
Don't know Fortran, but while C doesn't have generics you're getting similar behavior due to macros (for example min(), max() are macros) and weak typing. So the need of having generics there is much weaker.
- fwip 7y agoThere are a number of tools (and the "go generate" construct) designed to support code generation. If you just want macro-level behavior, that's easy to do.
- takeda 7y agoYes, and that's what I'm currently doing, but it is essentially just automating writing the same code multiple times. It still has issues, like having to remember to regenerate the code on change, or making harder to use IDE features to refactor. There are also some limitations it has.
- nine_k 7y ago> automating writing the same code multiple times What would you call a language that forces you to write / use a preprocessor to introduce higher-level features? Low-level. More specifically, low-level for the domain where you're working. C is admittedly low-level because it had to be minimal even for 1970 and close to the metal. Other languages usually enjoy less drastic design constraints.
- pjmlp 7y agoYep, that is why some were already using PL/I and Algol dialects almost 10 years before C came to be, alongside Fortran, Cobol and Lisp.
- pjmlp 7y agoJust like Borland C++ 2.0 for MS-DOS did, before templates were started to be designed. I let you research when it was released.
- pjmlp 7y agoEven C does have generics now (_Generic) even if quite limited.
- takeda 7y agoNeat, I had no idea.