you also have methods that receive and return thes...
# announcements
j
you also have methods that receive and return these types. that transformation would work for methods which receive these types but not for returning
m
Same as if you return
struct
in C -- it will be copied to temporary place. In case of JVM - boxed before return.
j
Yes but that fundamentally undermines the
inline
part of
inline class
. If you need that, just use a box in the first place.
m
Why? Boxing just for return from no-inline function, if caller need to assing returned value to something - it must unbox it.
It works in C ABI for decades
j
Because it's not
inline
! The whole point of the feature is that it's allocation free. Call it a
struct class
or something else if you're going to hide allocation behind the compiler.
m
Allocation and almost immediately dispose object is cheap operation in jvm. Again, C lives with this "black magic" for decades, calling
memcpy
under the hood.
j
I've stated the same thing twice and don't feel like doing it a third. If your only argument is that other things do this then let's just use those other things instead of designing a whole new programming language where we have the opportunity to correct behavior.
m
OK, of course I'm not expert here 🙂