4 ms·
They could probably learn one or two things on how Java and .NET do arenas, just saying.
by pjmlp 11mo ago
They could probably learn one or two things on how Java and .NET do arenas, just saying.
- riku_iki 11mo agoNot sure about .NET, but Java doesn't have arenas..
- kernal 11mo agojava.lang.foreign.Arena
- riku_iki 11mo agoMy understanding is that that arena allows you to allocate memory segments, but you can't do much with it, you can't allocate var or object on it like in C++ for example, so its almost useless.
- pjmlp 11mo agoYou certainly can, as they were designed as JNI replacement, with the goal to fully support the C ABI of the host platform. You can either do the whole boilerplate manually with Panama set of APIs, or write a C header file and let jextract do the work of boilerplate generation.
- riku_iki 11mo ago> You certainly can I am wondering if there is working code example, or this is just speculation?
- kernal 11mo agohttps://docs.oracle.com/en/java/javase/21/core/memory-segments-and-arenas.html#GUID-01CE34E8-7BCB-4540-92C4-E127C1F62711 https://docs.oracle.com/en/java/javase/21/core/memory-segmen...
- riku_iki 11mo agoThat Arena is not integrated into language. You can't do something like: var myObj = new(my_arena) MyClass();
- pjmlp 11mo agoIt surely has them since Project Panama, as memory segments.
- metaltyphoon 11mo agoIt’s this simple in .NET ArrayPool<T>
- 9rx 11mo agoThey did. That is how they learned arenas are the wrong abstraction and why the project is now looking at memory regions instead.
- pjmlp 11mo agoDoesn't look like it, in the end it will be like generics, half way there.
- 9rx 11mo agoLooks like the opposite of generics. Go's generics story is intrinsically linked to Java. It was the Java team that told the Go team to not implement generics until they were perfectly satisfied with the solution, and it was the same guy who ultimately designed both Java's and Go's generics. You cannot take a closer look at Java's generics than that.
- pjmlp 11mo agoExcept the Go's implementation is not as capable as Java's one. Phil Walder delivered a design within Go's team goals. Java team has told nothing to Go's team, they have acknowldeged their bias anti-generics. ". They are likely the two most difficult parts of any design for parametric polymorphism. In retrospect, we were biased too much by experience with C++ without concepts and Java generics. We would have been well-served to spend more time with CLU and C++ concepts earlier." https://go.googlesource.com/proposal/+/master/design/go2draft-generics-overview.md https://go.googlesource.com/proposal/+/master/design/go2draf...