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.
I think the one really useful suggestion here is at the end of the article. Having some way for the compiler to know that a struct satisfies a particular interface, and thereby create a fast path that sidesteps reflection would be marked performance improvement (and avoid the need for caching).
TBH, anything that can make interface casting faster/more efficient in go would be a welcome improvement.
I’ve used flag.Value a couple of times. That may be one of the few places I agree with the author, but I don’t really care that flag.Value is a pain. It’s just one of many options for handling flags (I use kong for anything non-trivial). If your complaints about Go boil down to command line parsing and not understanding interfaces, you are probably a future gopher in denial.
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.
I think the one really useful suggestion here is at the end of the article. Having some way for the compiler to know that a struct satisfies a particular interface, and thereby create a fast path that sidesteps reflection would be marked performance improvement (and avoid the need for caching).
TBH, anything that can make interface casting faster/more efficient in go would be a welcome improvement.
[dead]
[flagged]
I’ve used flag.Value a couple of times. That may be one of the few places I agree with the author, but I don’t really care that flag.Value is a pain. It’s just one of many options for handling flags (I use kong for anything non-trivial). If your complaints about Go boil down to command line parsing and not understanding interfaces, you are probably a future gopher in denial.