3 ms·
That's entirely different. Generics can be replaced by code-generation (C++-style templates) in a preprocessor with no loss of safety, or by boring copy-paste (
by gohrt 12y ago
That's entirely different. Generics can be replaced by code-generation (C++-style templates) in a preprocessor with no loss of safety, or by boring copy-paste (with some loss of safety :-().
non-static typing is a massive loss of safety.
- pcwalton 12y agoStatic typing can be replicated in a dynamically typed language with a preprocessor too. (For example, see TypeScript.)
- seanmcdirmid 12y agoTemplates/macros/preprocessing do sacrifice separate compilation and separate type checking; so your error messages might not be comprehensible, your compile times can be much slower, and...you need source for your generic container. Rob Pike probably knows the drawbacks of that approach well and I doubt he would go there.