4 ms·
Could you provide more context on what’s disgusting? I’m not a go programmer but this looks like it’s just a wrapper around a library called ‘maphash’ and doesn
by lukevp 3y ago
Could you provide more context on what’s disgusting? I’m not a go programmer but this looks like it’s just a wrapper around a library called ‘maphash’ and doesn’t do any of the hashing here? This is more of a service wrapper around that lib so that it can have a consistent seed value etc.?
- brabel 3y agoI suppose the use of unsafe pointers liberally is disgusting to some.
- sidlls 3y agoI wouldn't call it disgusting. It's just typical unsafe go code. The named return parameter in `getRuntimeHasher` is irritating, as all such parameters in go code are. If you're going to return values, do so explicitly in the return statement. In go code, seeing `return` at the end of a function does not mean that the function doesn't return any values, and that can lead to harder-to-read code.
- insanitybit 3y ago> It's just typical unsafe go code. But... just to hash something?
- sidlls 3y agoGo has a lot of lower level internal implementations of things that unsafe code like this serves as a thin shim for. It’s an almost zero-cost abstraction to use such a builtin. I’m not saying it’s good: it just is what it is. It’s silly: but so is most of go. I’ve worked with this language for several years now: I don’t like it at all. It presents a facade of simplicity, but has all sorts of hidden issues that affect performance and behavior in surprising ways.
- insanitybit 3y agoI think we're all saying the same thing then.
- tedunangst 3y agoConstructing a map (an opaque type) just so you cast it to a carefully duplicated struct so you can steal the function pointer is kinda nutso. Did you look at the linked code in maphash?