A
Axel Wagner
blog.merovius.de · Personal blog · on HN since 2016
Axel Wagner writes about Go, including generics, type sets, error handling, and backward compatibility, plus broader programming language topics.
What HN saysHN commenters cite it for explaining Go design decisions, such as variance and generics constraints, and for its essay on diminishing returns of static typing.
29HN people shared it
11linked it in comments
33stories submitted
1.0Kstory points
1 year agolast shared
2016people per year2026
Most-shared posts
- 1Diminishing returns of static typing5 people · 443 points · first shared 2017 · 617 comments on HN
- 2Persistent datastructures with Go3 people · 48 points · first shared 2018 · discussion on HN
- 3Backwards compatibility in Go (2015)3 people · 47 points · first shared 2017 · 34 comments on HN
- 4Constraining Complexity in Go Generics3 people · 5 points · first shared 2024 · 2 comments on HN
- 5Calculating Go type sets is harder than you think2 people · 88 points · first shared 2022 · 40 comments on HN
- 6How to not use an http-router in go2 people · 7 points · first shared 2017 · 1 comments on HN
- 7What even is error handling?2 people · 4 points · first shared 2018 · discussion on HN
- 8Monads are just monoids in the category of endofunctors2 people · 3 points · first shared 2018 · discussion on HN
- 9Ext4: Mysterious “No space left on device”-errors (2013)2 people · 2 points · first shared 2016 · discussion on HN
- 10Why context.Value matters and how to improve it2 people · 2 points · first shared 2017 · discussion on HN
- 11Using Hilbert Curves to 100% Zelda1 people · 164 points · first shared 2017 · 61 comments on HN
- 12Scrapping Contracts: a critique of the Go generics proposal1 people · 86 points · first shared 2018 · 26 comments on HN
- 13Operator constraints in Go1 people · 47 points · first shared 2022 · 18 comments on HN
- 14Using roughtime as a “cryptographic notary”1 people · 42 points · first shared 2018 · 13 comments on HN
- 15Ext4: Mysterious “No space left on device”-errors due to hash collisions (2013)1 people · 15 points · first shared 2022 · discussion on HN
What HN people wrote when they linked it
mihaitodor · 2024-10-10
I recall reading some details around this on https://blog.merovius.de. Maybe it was this article: https://blog.merovius.de/posts/2018-06-03-why-doesnt-go-have-variance-… Compilation speed plays a big factor when deciding which features are added to Golang and I think they'd have a hard time maintaining the current compilation speed if they remove this limitation.
earthboundkid · 2020-12-04
Cancellation is a little tricky. If things can cancel at any point, then it's impossible to write safe/correct code. Async has the advantage that the await calls are natural sync points, so it's (probably) safe to cancel there. But historical experience has also shown that people will forget to yield when they should, and it will lead to cooperation problems.
I think the best approach has to look something like Go's, but perhaps a bit more structured (dynamic scoping[1] might help perhaps with task nurseries[2]). Unless you're writing extremely low level code, you want your language runtime to intercept all syscalls and figure out the async story for you. The language should handle making sure that the M:N mapping works out, no one opens a socket the wrong way etc. Then for you as the program writer, your responsibility is just setting explicit cancellation points as part of the general error handling approach. It's still not perfect, but I think that would be the next evolution from what exists today.
[1] https://blog.merovius.de/2017/08/14/why-context-value-matters-and-how-…
[2] https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statemen…
hellofunk · 2018-06-21
I'm a fan of this multi-language trend of gradual and optional typing. Static typing has definite benefits, but there are also diminishing returns on productivity as a language becomes more and more statically safe. Often times, type safety is a rabbit hole that can easily turn a language into what some call a "puzzle language," where the efforts to please the compiler become non-intuitive and take long times to figure out. Some of the classes in Swift for example have to adopt a hundred protocols just to compile. Rust is an even more extreme example. You might get extra safety, but at significant development cost.
Gradual typing in Python is a happy medium that lets the developer decide (to some degree) on the workflow up front. It's a nice compromise for a wide range of work.
I love this explanation from a few months ago:
https://blog.merovius.de/2017/09/12/diminishing-returns-of-static-typi…
pansa2 · 2024-11-17
I'm surprised by the complexity of Go's generic constraints, given the language's focus on simplicity. Things like the difference between "implementing" and "satisfying" a constraint [0], and exceptions around what a constraint can contain [1]:
> A union (with more than one term) cannot contain the predeclared identifier comparable or interfaces that specify methods, or embed comparable or interfaces that specify methods.
Is this level of complexity unavoidable when implementing generics (in any language)? If not, could it have been avoided if Go's design had included generics from the start?
[0] https://stackoverflow.com/questions/77445861/whats-the-difference-betw…
[1] https://blog.merovius.de/posts/2024-01-05_constraining_complexity/
glenjamin · 2024-08-21
The Go standard library makes use of a number of “optional interfaces”, which it uses to detect when a type implements a higher level action in a more efficient or specific way
This can be thought of as duck typing.
Examples can be found here: https://blog.merovius.de/posts/2017-07-30-the-trouble-with-optional-in…
SkyMarshal · 2021-06-13
>I have never got all these jokes.
If you mean that literally, this joke is referencing another joke meme in the functional programming community, explained here: https://blog.merovius.de/2018/01/08/monads-are-just-monoids.html
If you mean, you don't get why people joke about Git being hard, it probably isn't for most professional programmers already accustomed to some kind of source control, just perhaps to anyone new to it.
nh2 · 2021-04-15
> Are there limits to the number of files a directory can hold?
Yes, depending on the file system.
For example, ext4 with default settings uses 32-bit hashes. Upon the first collision, you can no longer add more files to the directory (ENOSPC error).
Source: https://blog.merovius.de/2013/10/20/ext4-mysterious-no-space-left-on.h…
anonymoushn · 2020-07-08
Has something changed such that adding an exported field to a struct is now safe in the case of clients who are using struct embedding? Previously: https://blog.merovius.de/2015/07/29/backwards-compatibility-in-go.html
wespiser_2018 · 2019-03-05
Re: Diminishing Returns of Static Typing: https://blog.merovius.de/2017/09/12/diminishing-returns-of-static-typi…
skybrian · 2018-03-27
See "adding a field to a struct" on this page:
https://blog.merovius.de/2015/07/29/backwards-compatibility-in-go.html
Merovius · 2025-07-10
> You need to have something that uses those templates.
Exactly. That is what I said:
> because you need to know the actual type arguments used, regardless of what the constraints might say.
It is because type-checking concept code is NP complete - it is trivial to check that a particular concrete type satisfies constraints, but you can not efficiently prove or disprove that all types which satisfy one constraint also satisfy another. Which you must do to type-check code like that (and give the user a helpful error message such as “this is fundamentally not satisfiable, your constraints are broken”).
And it’s one of the shortcomings of C++ templates that Go was consciously trying to avoid. Go’s generics are intentionally limited so you can only express constraints for which you can efficiently do such proofs.
I described the details a while back: https://blog.merovius.de/posts/2024-01-05_constraining_complexity/