" If it’s a reference type then it will need to descend from Object and be garbage collected like anything else, so the whole memory advantage is blown again"
I think you are missing the memory advantage I want. I don’t care that it is GCed, in fact, I 'm counting on it.
I don’t care about Native memory ( I do, but for agrument sake, I don’t) so why should be Struct have anything to do with ByteBuffers. Now if the VM wants to map it that way behind the scenes, I could careless.
What I want/need, is a c-struct Struct, simple, clean, efficient.
Yes, you can build trees with structs, they can have pointers, so Java Structs can have object references.
Yes, they should be passed by reference and not by copy (this one is obvious - this isn’t LISP :-))
No, they do not need methods or inheritances, and that IS the point of the object I am describing. Structs hold data (primitives and references) and nothing else. If mapping them to buffers limits their references use, forget it. I think about it, that will never get pass the VM/Language people - a new object-liek type that can’t reference the existing Java objects except through user implemented indirection tables!? Whoa
The idea here is to make a Java object type that would work like Vectors and Martices do in C, because it is the lowest possible memory overhead and run-time overhead, and for certain programming techniques is cleaner than straight OO (ok last one is opinion :-))
The thing you are desrcibing now has too many exceptions (no Java references) and misses the run-time gains (no method reflection overhead, JIT, etc.)
The computation math folks have been discussing similiar contructs since Java ran on vector processors, because the overhead when you have 100,000s of vectors and matrices (also in 3D) ends up blowing your memory and run-time access performance.
One more wrench I want to toss in there since we are “dreaming” - I want a way I can declare arrays of your structs or my structs created in such a way that they are contiguous memory, like in C/C++, that way the caching behavior of sequential access is much better (since that is in high use in the struct techinques involving vectors etc - although I imagine a VM can do this behind the scenes, at least for “fresh” arrays)
Are we any closer?