[foreign-memaccess] on layout equality
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Tue Jul 23 13:38:33 UTC 2019
Hi,
there is one aspect of the layout API that we have not explored fully:
how should layout behave w.r.t. equality? There are the following options:
1) equality should only test 'core' properties of the layout (e.g. size,
alignment, ...)
2) equality should also include optional, side-channel info such as
layout names (or, in the foreign-abi branch, layout annotations)
3) we should have both flavors of equality
4) do not support equality at all
Between (1) and (2), I think I lean towards (1). Yes, we can attach a
name to a layout, but doing so does NOT change the layout properties -
the layout still has same size, alignment, etc. On the other hand, (3)
seems like overkill and (4) seems overly punitive. I say "seem" because
I really don't know here how people will be using layouts, and it is
very possible that we are jumping to the conclusion that layouts must
somehow be comparable with equals() because our implementation internals
is happy this way. As Brian pointed out once, it is very likely that
layouts will be constructed, stashed in a static field and never looked
at again. In which case an answer like (4) is not totally out of the
question.
What do people think on this?
Cheers
Maurizio
More information about the panama-dev
mailing list