2 ms·
> New Code is a lot cleaner: matcher2 := match.If(match.Binary(match.Ident("err"), token.NEQ,match.Ident("nil")),match.Block(match.Multi(match.Return(match.Mult
by marcus_holmes 3y ago
> New Code is a lot cleaner: matcher2 := match.If(match.Binary(match.Ident("err"), token.NEQ,match.Ident("nil")),match.Block(match.Multi(match.Return(match.Multi(match.Ident("nil"), match.Ident("err"))))))
In what world is this cleaner or easier to read?
- slantedview 3y agoThat's not the code that a user would write to use this pattern, that's code that a library that implements this pattern might use.
- marcus_holmes 3y agoI mean, you're not wrong. But how does that change anything? I still have to read it, and it's still harder to read as one long chain.
- hmry 3y agoI don't get it. Why do you have to read the internal implementation details of a preprocessing tool when using it?
- marcus_holmes 3y agoBecause it modifies code you're going to deploy on a production server. Therefore you need to audit it to make sure it's not going to deploy malware.