←back to thread

Hyrum's Law in Golang

(abenezer.org)
98 points thunderbong | 4 comments | | HN request time: 0.001s | source
1. raverbashing ◴[] No.42202306[source]
It's like an inverted game of cat and mice

1 - Lang/OS/Lib developer puts out a quirky or buggy API (or even just an ok API)

2 - Developers rely on a quirky, weird or unexpected side effect because it's easier/more obvious or it just works this way due to a bug

3 - Original developer can't fix it because it would break compatibility

4 GOTO 1

replies(2): >>42202332 #>>42202389 #
2. withinboredom ◴[] No.42202332[source]
Immediately reminded of this: https://externals.io/message/126011 that is an ongoing conversation in php-internals about removing a quirky/buggy behavior from PHP that, at the very end (at least of this comment's time) someone jumps in and says "yep, its useful, please keep it"
3. Cthulhu_ ◴[] No.42202389[source]
And this isn't even quirky/buggy, it's just the string representation of an error. That said, Go took a while to improve its core error mechanisms and add utilities for matching errors by type instead of its string representation.
replies(1): >>42203387 #
4. simiones ◴[] No.42203387[source]
In this case, it really is - because until Go 1.19, that function simply returned `errors.New("http: request body too large")`. So until Go 1.19, there really was no other way to check if this error occurred than `err.String() == "http: request body too large"`. Even if we had had errors.Is/As earlier, it wouldn't have helped in this case.