- Joined
- Oct 19, 2023
yeah that's more of what i'm trying to say: you can use it as a void* but only sort of and the compiler just needs to check that you don't mix them up in weird waysIn Java, if you want to do a generic with a primitive type parameter, you have to box it in Integer, Boolean, etc. You chew through the heap because everything needs to be a pointer all the time. In C++ and Rust, copying makes sense. You can't really compile a template though, so you would need to either have it in the header or provide an interface for the Java-style void* generics, which I wouldn't mind.
and unbox integers too or whatever
i feel like java's case is sort of a compiler (and/or language design) skill issue