3 ms·
You totally can build it using unsafe and generics. I’ve done it with mmap-backed byte slices for arbitrary object storage.
by bilbo-b-baggins 10mo ago
You totally can build it using unsafe and generics. I’ve done it with mmap-backed byte slices for arbitrary object storage.
- 9rx 10mo agoWith a number of caveats. You cannot reimplement arenas as the experiment did without special hooks into the runtime. https://github.com/golang/go/blob/master/src/arena/arena.go https://github.com/golang/go/blob/master/src/arena/arena.go
- trhway 10mo agoThe special hooks for context and arena (actually arena(s) can be part of context) should have eliminated the need to change signatures for threading context and arena handles through the chain of calls. Instead there should have been an API (both - internal and user accessible) to check and pick, if present, the closest one on stack (somewhat similar to how you can get ClassLoader and the hierarchy of them in Java)
- foobiekr 10mo agoI have done the same; it's not natural to do it this way. Go should actually express an explicit mechanism to do this. When I did it, it felt exactly like trying to use epoll from Go: you can do it, it just feels like crap.