Disappointed by the type system of your favorite l...
# random
c
Disappointed by the type system of your favorite language? Things could be worse:

http://i.imgur.com/LwdWaAl.jpg

💩 6
m
This is the best hack to get generics in Go!
c
Someone on the Go team once said they think generating source code to emulate generics is good design
m
Generating code often seems like a good idea. You wouldn't expect Kotlin devs write all the extensions for
List
,
Set
, etc... by hand.
// NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
c
“Generating code” without any additional context is hard to judge. There are good and bad reasons to do that.
We certainly generate a lot of code on the JVM with the rise of annotation processors, but I’d argue these use cases make more sense than generating code to emulate the lack of generics
I don’t know if it’s still the case but back in my C++ days, I remember the linker (I think) generated all versions of templates for various data types, which led to huge object files.
.o
files, though, not source
d
most of funKTionale is generated
i
I'd prefer not to generate all those functions if the type system allowed me not to do it.
g
this is how Go++ is born