Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
mdlayher
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
4 ms
·
1.
▲
Unsafe String Interning in Go
(mdlayher.com)
3 points
by
mdlayher
6y ago
|
0 comments
2.
▲
by
mdlayher
6y ago
In this particular case, the compiler can't infer the type of V if you omit the type parameters at the call sites: type checking failed for main prog.go2:17:3: cannot infer V (prog.go2:46:27) prog.go2:22:3: cannot infer V (prog
3.
▲
by
mdlayher
6y ago
Oh wow, for some reason I totally zoned out and finally understand what you mean. Yes, you're right! I should fix that.
4.
▲
by
mdlayher
6y ago
Yep that is true. I wanted both values to be comparable for an easy demo but would write it as you've suggested if I intended to make this a general purpose package.
5.
▲
by
mdlayher
6y ago
I like the idea, I just haven't given it a try with the new draft yet. Sounds like it's worth exploring at the very least.
6.
▲
by
mdlayher
6y ago
The alternative is to do something like: type Int int func (i Int) Hash() uintptr { /* do the hash */ } But I didn't want to deal with it in this code. I agree that it isn't optimal and would be curious to see if the sit
7.
▲
by
mdlayher
6y ago
Right, but you can only write strings or bytes to the hash, not integers, booleans, structs, etc. So the problem remains.
8.
▲
by
mdlayher
6y ago
Exactly. Thanks!
9.
▲
Go generics draft design: building a hashtable
(mdlayher.com)
196 points
by
mdlayher
6y ago
|
130 comments
10.
▲
Matt's Remote Workspace in 2020
(mdlayher.com)
2 points
by
mdlayher
7y ago
|
0 comments
11.
▲
CoreRAD: A new IPv6 router advertisement daemon
(mdlayher.com)
1 points
by
mdlayher
7y ago
|
0 comments
12.
▲
by
mdlayher
8y ago
Hey folks, presenter here! Happy to answer any questions you all may have, and thanks again to Sourcegraph for the live blog!