Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

They could probably learn one or two things on how Java and .NET do arenas, just saying.




They did. That is how they learned arenas are the wrong abstraction and why the project is now looking at memory regions instead.

Doesn't look like it, in the end it will be like generics, half way there.

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.

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...


> 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.



No need to outsource words. If I wanted to converse with Leapcell, I'd go to him directly.

Especially when it doesn't even begin to address the concern. The disconnect is not in where Go generics are limited, but where you find the exception. There is nothing that I can find to "except against". What was "Except" in reference to?


Not sure about .NET, but Java doesn't have arenas..

It surely has them since Project Panama, as memory segments.

It’s this simple in .NET

   ArrayPool<T>

will elements of arraypool still be tracked by GC with overhead?

Depends on the T.

.NET has value types, explicit stack allocation, low level unsafe programming C style, and manual memory management as well.


java.lang.foreign.Arena

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.


That Arena is not integrated into language. You can't do something like:

var myObj = new(my_arena) MyClass();


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.


> You certainly can

I am wondering if there is working code example, or this is just speculation?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: