5 ms·
Macros are another can of worms. Even if they're AST-aware like in Rust, you can do very complicated stuff with them and they are very hard to read/write/debug.
by emersion 8y ago
Macros are another can of worms. Even if they're AST-aware like in Rust, you can do very complicated stuff with them and they are very hard to read/write/debug. This would kill the advantage that it's very hard to write obscure Go code.
- heavenlyblue 8y ago>> his would kill the advantage that it's very hard to write obscure Go code. But it's very easy to spread that Go code into tens of Kloc. The amount of error handling and if constructs make me feel as if I am readying assembly: predictable AF, but it doesn't help because the volume of the code is huge.
- robmccoll 8y agoThat's so true. It would be great to be able to have very limited / very short macros as a compromise. var a = n1; if a < n2 { a = n2 } vs. var a = max(n1, n2) without having to write and make a function call. I still want something more powerful for error handling like a type that if it is ever assigned non-nil the method returns immediately. var err autoreturn error rslt, err = pkg.MaybeError()
- j16sdiz 8y agoThis is true. But it is go design philosophy not to hide too much magics, it favours verbose, explicit codes. Design choice. You can't have both.