4 ms·
This article highlights very well why designing a programming language without generics is a mistake. Adding it after the fact is not trivial, especially if you
by u320 8y ago
This article highlights very well why designing a programming language without generics is a mistake. Adding it after the fact is not trivial, especially if you have high standards wrt simplicity and non-redundancy.
- jstimpfle 8y agoYou're implying that there is a better design that has generics and caters to the same programmer folks. But you don't show what that design is. The OP didn't imply there was one.
- apta 8y agoD, Rust, C#, ML, Delphi, etc.
- jstimpfle 8y agoI haven't used all the other ones, but "Delphi" really made me crack up. I used it for 6 months before I quit my job. It's a mess, junk after junk added on a pile of junk, only surpassing the junk-adding badness of C++ by also having this broken standard library that's somehow required to write any type of software (because the simplest thing, C-like pointers, exist but are really not nice to work with). The task that lead to my decision to quit was to write a data serialization systems for datastructure that I didn't know in which version of junk they were expressed, by interfacing with the broken standard library. The serialization system was to replace another serialization system that somehow didn't quite work. No wonder, it was broken code, and I couldn't see a way to write non-broken code to solve an unsolveable problem. What's nice about Delphi is that the compiler is quick and it has a beginner-friendly IDE with a visual GUI creator (no selling point for me). That's about it, AFAICT.
- apta 8y agoI was referring to generics systems that don't suck.
- emersion 8y agoI don't think so. The article explains also that generics as implemented in other programming languages bring a lot of complexity and that generics aren't mandatory.
- ernst_klim 8y agoYou already have the complexity in Go, just without type safety. You already have boxing in Go, all interfaces are boxed, so you can easily add Java/OCaml style parametricity without even any changes to your runtime. interface{} is already promoted to heap, they are pointers, all you need is to swap interface with type parameter and add a couple of hundreds lines of code to the type checker. The theory is all in the books and there are dozens of compilers implementing it in practice.
- louthy 8y agoI agree. C# still has the legacy of its pre-generics era. It's not super-bad, but it still hangs around like a bad smell. If it ever gets higher-kinds then the current implementation of monadic types with the hacky extension methods will also hang around like a bad smell. It seems crazy to me that language designers of modern statically typed languages wouldn't go for the state-of-the-art. I see the comments about simpilicty, but generics makes [working with abstract types] simpler (in my humble opinion, of course).