extern generics classes fix, documentation on extern classes updated
This commit is contained in:
1 parent
74eb8ff082
commit
8e0442670d
10 files changed
+28
-58
No files matched your search
@@ -4,7 +4,7 @@ This note describes the Lyng-first workflow where a class is declared in Lyng an
|
||||
|
||||
## Overview
|
||||
|
||||
- Lyng code declares a class and marks members as `extern`.
|
||||
- Lyng code declares a class and marks members as `extern` (or puts them inside `extern class`/`extern object`, where member `extern` is implicit).
|
||||
- Kotlin binds implementations with `LyngClassBridge.bind(...)`.
|
||||
- Binding must happen **before the first instance is created**.
|
||||
- `bind(className, module, importManager)` requires `module` to resolve class names; use
|
||||
@@ -13,7 +13,7 @@ This note describes the Lyng-first workflow where a class is declared in Lyng an
|
||||
- `instance.data` (per instance)
|
||||
- `classData` (per class)
|
||||
- `extern class` / `extern object` are pure extern surfaces:
|
||||
- all members in their bodies must be explicitly `extern`;
|
||||
- all members in their bodies are implicitly extern (`extern` is optional/redundant);
|
||||
- Lyng member bodies inside extern classes/objects are not supported.
|
||||
|
||||
## Lyng: declare extern members
|
||||
|
||||
@@ -276,7 +276,7 @@ Map inference:
|
||||
- `{ "a": 1, "b": "x" }` is `Map<String,Int|String>`.
|
||||
- Empty map literal uses `{:}` (since `{}` is empty callable).
|
||||
- `extern class Map<K=String,V=Object>` so `Map()` is `Map<String,Object>()` unless contextual type overrides.
|
||||
- `extern class` / `extern object` are declaration-only; members in their bodies must be explicitly marked `extern`.
|
||||
- `extern class` / `extern object` are declaration-only; members in their bodies are implicitly extern.
|
||||
|
||||
Flow typing:
|
||||
- Compiler should narrow types based on control-flow (e.g., `if (x != null)` narrows `x` to non-null inside the branch).
|
||||
|
||||
Reference in new issue
Block a user