5 ms·
> Russ Cox' original formulation of the now-famous tri-lemma is incomplete at best. Could someone give a brief introduction to what this sentence means? I have
by SideburnsOfDoom 13y ago
> Russ Cox' original formulation of the now-famous tri-lemma is incomplete at best.
Could someone give a brief introduction to what this sentence means? I have absolutely no idea about any of it.
- signa11 13y agoprobably this: http://research.swtch.com/generic http://research.swtch.com/generic ? go had 3 options for implementing generics: 1. leave generics out : the c way (slows programmer) 2. do it at compile time: c++ way (slows compilation) 3. box/unbox everything implicitly: java way (poor perf)
- SideburnsOfDoom 13y agoHm. Which of these does C# use? Which does Haskell use?
- pjmlp 13y agoRegarding C# it depends on which compiler you talk about. Microsoft's current JIT/NGEN, generate a single version for reference types and a separate version for each value type. So a mix of Java/C++ approaches. Not sure what the new JIT/NGEN compilers, RyuJIT will use. I also don't know what approaches are taken by Mono, Bartok and IL2CPU, but they might be similar.
- SideburnsOfDoom 13y agoYep, now I can see why this is trilema is "incomplete at best" - c# and other use what can be described as a mixture of these three approaches. I was going to say that the c# compiler is fast enough despite this, but then I remembered that one of go's selling points is that the go compiler is blindingly fast compared to languages such as c#. Perhaps maintaining that performance with generics is a real issue.
- pjmlp 13y agoAlthough any language with modules is fast enough, compared with C and C++. Many old timers like myself can remember the blazing fast compile times of Modula-2 and Turbo Pascal compilers in MS-DOS systems. Go compilers also lack a strong optimizer, which is tends to slow down compilation.
- dbattaglia 13y agoI believe C# does it at runtime for reference types, and compile time for value types, so that you don't eat the cost of boxing at runtime. It doesn't make sense to make separate compile time generic types for reference types in C# since the type is basically constrained to using system.object members anyway (unless you add type constraints to the generic type class definition).
- thirsteh 13y agoHaskell: A mix of 2 and 3.
- dysoco 13y agoIt's ironic considering that the Go developers want the best for the programmer (That's why they work so hard on the Go tool for example).
- chimeracoder 13y agoWell, the default case (leave them out, make do for the time being) allows the option of adding generics later on (in a hypothetical Go 2.0 or later). Using a half-baked model and implementation now boxes the language in later on.
- arnehormann 13y agoAlso look at a list of proposed ways to add generics (and why they didn't make it): https://github.com/remyoudompheng/go-misc/blob/master/generics/generics.markdown https://github.com/remyoudompheng/go-misc/blob/master/generi...