where are all the objects?
Brian Goetz
brian.goetz at oracle.com
Wed Aug 10 19:34:01 UTC 2022
On 8/10/2022 3:17 PM, Dan Heidinga wrote:
> Which fits with the VAO model. Object references are clearly our
> giraffe leashes but that doesn't give us a good word for the flattened
> papery giraffe itself. The challenge here is we're not describing a
> property of the thing, we're describing the lack of something (the
> leash or reference). Add to this the VM doesn't provide guarantees
> about the storage for the non-reference case - it's all VM discretion
> on whether to flatten or not - so accurate terms feel like weasel words.
>
> Does the VAO model feel less forced if we're explicit about references
> being the difference?
> - A value object can also be represented without an object reference,
> as primitives are today // (*)
>
This is actually the new weirdness -- that you have a choice about how
to handle a value object. Previously we had two kinds of things:
primitives (direct values) and object references (which can be null, or
can have an object at the end of them, but you can't touch the object,
only the reference.) Now we still have two kinds of values: value
objects, and object references -- but object references can also refer
to value objects! This is the weird part; that value objects have two
separate placements / representations / interaction modes. We got away
before without a notion of "bare object" because the only way you could
touch a primitive is directly, and the only way you could touch an
object is through a reference. But now some objects can be touched
directly, *or* through a reference.
C programmers would say "Duh, that's just X vs X*", but we want to blur
the difference, so we don't distinguish between `x.a` and `x->a` as we
do in C.
Brainstorming on terms....we haven't tried "unboxed".
- A Point.ref is a reference to a Point object
- A Point.val is an unboxed Point object
This fits into the "reference as default" model, but it suggests that
Point.val are *not* objects, they are the "scooped out filling" of an
object. So I guess this is more of a VANO term. Oh well.
Is there any mileage in splitting "reference" instead of object? Like, a
"lightweight reference" (a short leash), which doesn't support
polymorphism or null? Then a Point.val is a "lightweight reference" to
a Point?
The VAO term we are looking for might be more like "grab the giraffe by
the collar, rather than by the leash" :)
More information about the valhalla-spec-observers
mailing list