Nest host validation vs NestHost attribute performed by Lookup::defineHiddenClass
john.r.rose at oracle.com
Thu Sep 26 19:00:11 UTC 2019
On Sep 26, 2019, at 11:02 AM, John Rose <john.r.rose at oracle.com> wrote:
> 2. If an HC is injected into the nest of another class K, should it “see itself” in its *own* getNMs array? Thanks for raising this, David; I had not considered this bit of mess. I would prefer “no”, since that’s a new bit of “fixup logic” to add, but “yes” is OK too.
P.S. If we *do* add the HC to its *own* getNMs list (only there!) then I think we should document that it
is present at a particular location on the list, either the second element (after the NH) or the last
element. My preference would be last, since that makes the getNMs list as similar as possible
to the normal static list presented at other points in the nest.
But, there’s one more reason to *not* put the HC on its own getNMs list: This breaks the
invariant that the getNMs list is the *same* everywhere in the nest. For me that tips the
balance more strongly towards this rule: “getNMs contains only statically declared members
that have been validated, except in the sole case where getNMs is a singleton containing
the the requesting class itself.” In that latter case, regardless of static data, the requesting
class is its own nest-host and is a singleton nest (mono-nest?).
More information about the valhalla-dev