HookKey
A structured key that identifies a hook call site within a component's render method.
Each hook call is identified by a compiler-generated call-site id, a local identity, and a parent pointer. Ordinary hooks use their runtime occurrence index as the local identity. withNewScope replaces that occurrence index with a developer-provided key so hooks in a collection remain attached to the same item when the collection is reordered.
The id field packs two 32-bit integers into a single Long (see IntSize for a similar pattern):
High 32 bits: the call-site id — a stable hash of the enclosing callable identity and its local @Hook-call ordinal.
Low 32 bits: the runtime index — how many times this call-site has been entered within its parent hook invocation (distinguishes calls in loops).
When interning is enabled (see create's intern parameter), create returns the same object for the same (id, parent) combination across render passes, avoiding repeated allocations for deterministic hook call trees. This also enables fast referential equality checks in map lookups.
Parameters
Packed call-site id (high 32) and runtime index (low 32) for an ordinary hook key.
The HookKey of the enclosing hook if this call is nested inside another @Hook function, or null if at the top level of a component's render method.