Default Methods in Go

8 ingve 2 8/25/2025, 8:28:21 PM mcyoung.xyz ↗

Comments (2)

arp242 · 2h ago
The thing with default methods is that while the code may not "break" in the sense of "will not compile", it may very well break in the sense of "issues runtime panic", or even worse: "does the wrong thing".

I do agree all of this can be quite painful, but I'm not so sure that default methods are the right solution.

mama_mia9 · 13m ago
Sigh. Yet another person who feels entitled to critique Go before they've actually learned it.

> there is no canonical way to document that A satisfies B

Evidence supporting my prior assertion that the author is uninformed about Go. Yes, there is a way to do this. Rather than spell it out, you should spend some time learning about the subject you write about.

> nor can you avoid conforming to interfaces

This would be pointless. Again, evidence of ignorance of common use.

> you can’t add new methods to an interface without breaking existing code

More evidence. This is a desirable feature; in fact, kind of the one of the points of an interface.

> flag.Value is a mess

Nobody uses flag.Value. I've written Go for 12 years and not needed it once.

Enough. The rest is more of the same.

These are the misguided, uninformed, and frankly unbalanced thoughts from an obviously smart person who couldn't take the time to actually learn Go, and is picking out things that strike him as off coming from other languages.