Skip to content

TypeId: the counter starts lazily, without __init__ (v1) - #26

Merged
back2dos merged 1 commit into
v1from
lazy-type-id-v1
Nov 29, 2026
Merged

back2dos merged 1 commit into
v1from
lazy-type-id-v1

Conversation

@back2dos

Copy link
Copy Markdown
Member

The fix from #25, applied to v1, which has the same TypeId.

The counter is Null<Int>, null until the first id is taken, instead of being reset in __init__. TypeIds are made by other classes' static initializers, and Haxe documents no order between those and an __init__. Under hxmc, __init__ ran after them, ids repeated, and the differ confused node types. See #25 for the reproduction.

TypeId.hx is byte-identical to #25's; it's tested there (JS and hxmc, plus coconut.appkit's demo test).

🤖 Generated with Claude Code

TypeIds are made by other classes' static initializers (factories'
`TYPE`s), and Haxe documents no order between those and TypeId's own
static initialization. Under hxmc, `__init__` ran after the statics of
classes reached earlier: it reset the counter, later ids repeated earlier
ones, and the differ took one node type for another (a native view for
an empty node: "invalid cast" in RNativeBase.update). The counter is now
null until the first id is taken, which holds whatever the order. TypeIds
are made once per node type, so the test costs nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@back2dos
back2dos merged commit 571df6a into v1 Nov 29, 2026
1 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant