Calculating Go type sets is harder than you think
&gt; Go has the goal of having a fast compiler. And importantly, one which is guaranteed to be fast for any program.<p>&gt; ...<p>&gt; This is especially important for environments like the Go playground, which regularly compiles untrusted code.<p>To be clear here, the tradeoff being made is that it is more important that the compiler is fast than that it is able to tell programmers about clear bugs in their code.<p>I see the justification of the playground as unconvincing too. You can run &#x27;for {}&#x27; in the playground, and you&#x27;ll get &quot;timeout running program&quot;. They already have solved the problem for the playground because obviously at runtime a go program can take infinite time, and it doesn&#x27;t seem like it&#x27;s any harder to also constrain compilation in the same way.<p>The actual cost that the go compiler being fast has is that other parts of go are slow. In other languages, a macro will execute as part of compilation, and incremental compilation will work with it. In go, if you want a macro, you write a separate go program that generates code, write a &quot;&#x2F;&#x2F;go:generate&quot; comment, and then have no way of knowing when to run it, no way of having incremental compilation with it, and it invariably ends up being slower than the compiler expanding it itself would have been.<p>Now, if you want to know if you have an impossible type set, you&#x27;ll run &quot;go vet&quot; (which likely doesn&#x27;t do this validation, I haven&#x27;t checked) or one of the various linting tools, it&#x27;ll have to re-parse and re-compile all the code, it won&#x27;t cache, and it&#x27;ll ultimately give you the same answer the compiler could have given you.<p>I suppose this is superior in one way: when performing such generation and validation, you can do it against only your own code, rather than against third party code you import, while if it were part of the compiler directly it would typically end up running against all compilation units, even third party ones....<p>In practice though, even for &quot;slow to compile&quot; languages, I find that I spend more time finding and fixing bugs than I do waiting for compilation, especially with incremental compilation. On the other hand, with go, I spend less time total compiling code, more time total fixing bugs, and more time total running golangci-lint and various other bits of code-generation.<p>I spend exactly 0 time worrying that some adversarial third-party dependency I import will make my compile-times exponential, both in go where it can&#x27;t happen by design, but also in other languages where it could happen, but you know, doesn&#x27;t.