Skip to content

Commit 171f25e

Browse files
committed
Document final generic construction boundaries
1 parent 4239529 commit 171f25e

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

_doc/manual.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -934,9 +934,11 @@ Likewise, do not call `newInstance<T>()` from a generic class constructor. Const
934934
initialize nested state explicitly afterward.
935935

936936
On Lua, do not invoke a generic-construction method directly on a freshly constructed generic receiver. Prefer the
937-
free loader above, or store the receiver in a typed local first. Field mapping also does not support nested modules
938-
whose sibling submodules declare fields with the same name; use direct fields, inheritance, or unique shallow
939-
module field names for dedicated state classes.
937+
free loader above, or store the receiver in a typed local first. Multi-parameter generic-interface dispatch is also
938+
outside this loader contract; use one construction type parameter. `newInstance<T>()` is for runtime Jass/Lua
939+
construction and is not supported inside `compiletime(...)` expressions. Field mapping also does not support
940+
nested modules whose sibling submodules declare fields with the same name; use direct fields, inheritance, or
941+
unique shallow module field names for dedicated state classes.
940942

941943
These are compile-time transformations, not runtime reflection, and generate equivalent direct accesses in both
942944
Jass and Lua. They generate no runtime registry, type-name lookup, or reflection metadata. Keep serializable state

_tutorials/saveload.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,9 @@ normally. Keep the generic loader as a free function: on Lua, a method cannot cu
116116
from its generic owning class with additional type parameters declared by the method itself. Do not call
117117
`newInstance<T>()` from a generic class constructor; construct the state in the loader and initialize nested state
118118
explicitly afterward. Avoid calling generic-construction methods directly on freshly constructed generic receivers
119-
on Lua. Dedicated state classes should also avoid nested modules with sibling fields sharing the same name; prefer
120-
direct fields or ordinary inheritance.
119+
on Lua, and keep the loader to one construction type parameter rather than multi-parameter generic-interface
120+
dispatch. `newInstance<T>()` is not supported inside `compiletime(...)` expressions. Dedicated state classes should
121+
also avoid nested modules with sibling fields sharing the same name; prefer direct fields or ordinary inheritance.
121122

122123

123124
## Usage

0 commit comments

Comments
 (0)