| ▲ | pjmlp 3 days ago |
| They could probably learn one or two things on how Java and .NET do arenas, just saying. |
|
| ▲ | 9rx 3 days ago | parent | next [-] |
| They did. That is how they learned arenas are the wrong abstraction and why the project is now looking at memory regions instead. |
| |
| ▲ | pjmlp 2 days ago | parent [-] | | Doesn't look like it, in the end it will be like generics, half way there. | | |
| ▲ | 9rx 2 days ago | parent [-] | | Looks 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 2 days ago | parent [-] | | Except 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/go2draf... | | |
| ▲ | 9rx 2 days ago | parent [-] | | > Except the Go's implementation is not as capable as Java's one. I have no idea what you think is on the other side of that exception. Please clarify. | | |
|
|
|
|
|
| ▲ | riku_iki 3 days ago | parent | prev [-] |
| Not sure about .NET, but Java doesn't have arenas.. |
| |
| ▲ | pjmlp 3 days ago | parent | next [-] | | It surely has them since Project Panama, as memory segments. | |
| ▲ | metaltyphoon 3 days ago | parent | prev | next [-] | | It’s this simple in .NET ArrayPool<T>
| | |
| ▲ | riku_iki 3 days ago | parent [-] | | will elements of arraypool still be tracked by GC with overhead? | | |
| ▲ | pjmlp 2 days ago | parent [-] | | Depends on the T. .NET has value types, explicit stack allocation, low level unsafe programming C style, and manual memory management as well. |
|
| |
| ▲ | kernal 3 days ago | parent | prev [-] | | java.lang.foreign.Arena | | |
| ▲ | riku_iki 3 days ago | parent [-] | | My 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 2 days ago | parent | next [-] | | You 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 2 days ago | parent [-] | | > You certainly can I am wondering if there is working code example, or this is just speculation? |
| |
| ▲ | kernal 2 days ago | parent | prev [-] | | https://docs.oracle.com/en/java/javase/21/core/memory-segmen... | | |
| ▲ | riku_iki 2 days ago | parent [-] | | That Arena is not integrated into language. You can't do something like: var myObj = new(my_arena) MyClass(); |
|
|
|
|