|
|
|
|
|
by slrz
2331 days ago
|
|
And yet, maps and slices are implemented in Go. https://golang.org/src/runtime/map.go https://golang.org/src/runtime/slice.go I don't see why you couldn't do something similar in your own Go code. It just won't be as convenient to use as the compiler wouldn't fill in the type information (element size, suitable hash function, etc.) for you. You'd have to pass that yourself or provide type-specific wrappers invoking the unsafe base implementation. More or less like you would do in C, with some extra care to abide by the rules required for unsafe Go code. |
|