@neocompose/cli 0.89.0 → 0.89.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/neo-runtime.mjs +1992 -580
- package/dist/test-worker.mjs +207 -59
- package/package.json +1 -1
- package/skills/neocompose-cli/SKILL.md +1 -1
- package/skills/neocompose-cli/references/cli-development.md +1 -1
- package/skills/neocompose-cli/references/values/references.md +46 -16
- package/skills/neocompose-cli/references/world/variants.md +4 -3
|
@@ -26,7 +26,8 @@ public Reference<int> TrackedStat; // another member's int
|
|
|
26
26
|
|
|
27
27
|
- `Reference<T>` also works as a parameter, collection element, dictionary
|
|
28
28
|
value, and unbound generic argument (`Box<Reference<int>>`), and keeps that
|
|
29
|
-
storage type through push and pull
|
|
29
|
+
storage type through push and pull, including nested generic collections
|
|
30
|
+
and named tuples. Use `Set<T>` parameters for several
|
|
30
31
|
selections.
|
|
31
32
|
- `@settings(collection: Owner.Member)` binds a class reference to one
|
|
32
33
|
collection. Unbound references select any stored row of `T` or a subclass,
|
|
@@ -47,20 +48,38 @@ public Reference<int> TrackedStat; // another member's int
|
|
|
47
48
|
|
|
48
49
|
```neo
|
|
49
50
|
public Reference<Item> StarterSeed = root.Assets.Items.Index.Slug["seed.carrot"]!;
|
|
50
|
-
public Reference<int> Gold =
|
|
51
|
-
public Reference<string> Greeting =
|
|
52
|
-
public Reference<NeoVariant<Tree>> Look =
|
|
51
|
+
public Reference<int> Gold = root.Player.Gold;
|
|
52
|
+
public Reference<string> Greeting = root.Npcs.Index.Slug["mira"]!.Greeting;
|
|
53
|
+
public Reference<NeoVariant<Tree>> Look = root.Garden.Felled;
|
|
53
54
|
```
|
|
54
55
|
|
|
55
56
|
- An unbound handle default may name its row by a unique index: a `root`
|
|
56
57
|
path to a List, `.Index.<Name>`, and a string literal key. Other shapes are
|
|
57
58
|
initializer code.
|
|
58
|
-
- Slot defaults
|
|
59
|
-
|
|
60
|
-
default stays the bare
|
|
59
|
+
- Slot defaults accept compatible stored member paths directly; `Reference()`
|
|
60
|
+
remains valid. Literals and computed values cannot supply a slot, and `this`
|
|
61
|
+
does not exist yet. A `NeoVariant<T>` member's own default stays the bare
|
|
62
|
+
variant path.
|
|
61
63
|
- List and dictionary defaults may hold slot references, nested too:
|
|
62
|
-
`List<Reference<int>> Counts = [
|
|
64
|
+
`List<Reference<int>> Counts = [root.Save.Bits]`. Each instance
|
|
63
65
|
owns the collection; entries target the original slots.
|
|
66
|
+
- `Set<Reference<T>>` selections can mix bare paths and explicit references.
|
|
67
|
+
Computed selections deduplicate by target identity, not by current value.
|
|
68
|
+
A literal selection of fixed targets must not repeat the same target.
|
|
69
|
+
A selection literal may also evaluate its entries, for example
|
|
70
|
+
`[root.Assets.Items.First(), selected]`. Those entries must resolve to
|
|
71
|
+
existing objects; the selection evaluates when its owner is constructed.
|
|
72
|
+
A compatible `Set<T>` path is a computed selection, including a set of a
|
|
73
|
+
derived class assigned to `Set<Reference<Base>>`. Each selected object keeps
|
|
74
|
+
its identity; the selection does not acquire the source collection's row.
|
|
75
|
+
Convert a `List<T>` to a set with `.ToSet()`.
|
|
76
|
+
- A bare path to an existing reference copies its current target when the
|
|
77
|
+
object is constructed. Later rebinding of that source reference does not
|
|
78
|
+
rebind the copy.
|
|
79
|
+
- A nullable target still needs a stored row. Pin an otherwise absent
|
|
80
|
+
nullable member in its owner's initializer, for example
|
|
81
|
+
`new() { Maybe = null }`, before referencing it. A declaration default alone
|
|
82
|
+
does not create that row.
|
|
64
83
|
|
|
65
84
|
## Source forms
|
|
66
85
|
|
|
@@ -89,11 +108,18 @@ Reference<NeoDialogue>(id: "capitol-dialogue-id")
|
|
|
89
108
|
|
|
90
109
|
## Runtime semantics
|
|
91
110
|
|
|
92
|
-
`Reference
|
|
93
|
-
`root.Player.Gold`, `item.Count
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
111
|
+
When executable code expects `Reference<T>`, pass a compatible stored member
|
|
112
|
+
such as `this.Gold`, `root.Player.Gold`, or `item.Count` directly. This works
|
|
113
|
+
for constructor and function arguments, returns, typed locals, object
|
|
114
|
+
initializers, and collection entries. The reference keeps following that
|
|
115
|
+
slot when its value changes. `Reference(place)` remains valid when an
|
|
116
|
+
explicit reference is needed.
|
|
117
|
+
|
|
118
|
+
Locals, parameters, list or dictionary elements, vector components, getters,
|
|
119
|
+
query results, and new scalar values have no row. A narrowed nullable member
|
|
120
|
+
still names its declared storage type. When `Selected` is `Reference<Item>`,
|
|
121
|
+
`Reference(this.Selected)` is `Reference<Reference<Item>>`. Access checks
|
|
122
|
+
apply where the reference is formed.
|
|
97
123
|
|
|
98
124
|
```neo
|
|
99
125
|
this.A = 5; // writes 5 into A's target
|
|
@@ -106,8 +132,8 @@ this.A += 1; // reads A's target, writes it back
|
|
|
106
132
|
- Assigning a same-typed reference rebinds; anything else writes through.
|
|
107
133
|
`this.A = c ? first : second` rebinds when both arms are references, writes
|
|
108
134
|
when both are scalars, and reads the chosen target when mixed.
|
|
109
|
-
- A
|
|
110
|
-
parameter is an error.
|
|
135
|
+
- A value without a stored slot never becomes a reference: passing `3` to a
|
|
136
|
+
`Reference<int>` parameter is an error.
|
|
111
137
|
- Constructors may initialize their own reference fields but can't write
|
|
112
138
|
through external targets.
|
|
113
139
|
- `==` compares handles by identity and slots by value. Collections of
|
|
@@ -138,6 +164,10 @@ Lookup assignment still needs an existing backing row.
|
|
|
138
164
|
(`root.Assets.Quests.Daily` or `Reference(root.Assets.Quests.Daily)`) and
|
|
139
165
|
follow the same rules. The path may cross construction defaults and
|
|
140
166
|
declarations from the same push; no preliminary push or manual ID is needed.
|
|
167
|
+
Pull emits bare paths in `collectionValue` settings when the target is reachable
|
|
168
|
+
from a root; otherwise it retains `Reference(id: "...")`. Lookup variant folder
|
|
169
|
+
bindings and `.Bind(root.Assets.Items.Index.Slug["seed.carrot"]!)` use the same
|
|
170
|
+
implicit reference conversion.
|
|
141
171
|
Invalid reference settings are errors, never silently dropped.
|
|
142
172
|
|
|
143
173
|
## Init-built objects
|
|
@@ -145,7 +175,7 @@ Invalid reference settings are errors, never silently dropped.
|
|
|
145
175
|
An object `Root.neo` writes is init-built when its class has an `init` block.
|
|
146
176
|
A declaration binding may name a member inside it, and push stores that
|
|
147
177
|
member's row. A reference captured by `init` or a constructor
|
|
148
|
-
(`new Rule(
|
|
178
|
+
(`new Rule(this.Weather)`) keeps its target's row. Status refuses a
|
|
149
179
|
value row's reference to a member of an init-built object (bind it from a
|
|
150
180
|
declaration instead) and a binding to a class or list that an `init` block
|
|
151
181
|
builds.
|
|
@@ -86,7 +86,7 @@ class root.
|
|
|
86
86
|
NeoLookupVariantFolder<ExampleObject, NeoSortingLayer> Root = new(
|
|
87
87
|
path: "",
|
|
88
88
|
collection: Assets.SortingLayers,
|
|
89
|
-
collectionValue:
|
|
89
|
+
collectionValue: root.Assets.SortingLayers,
|
|
90
90
|
);
|
|
91
91
|
|
|
92
92
|
@id("736dddf8-2881-47e1-a1d3-55fb65ea9f2a")
|
|
@@ -97,13 +97,14 @@ NeoLookupVariant<ExampleObject, NeoSortingLayer> Layered = new(
|
|
|
97
97
|
```
|
|
98
98
|
|
|
99
99
|
- `collection` names the eligible list member; `collectionValue` the stored
|
|
100
|
-
list whose rows it enumerates. Prefer the `
|
|
100
|
+
list whose rows it enumerates. Prefer the bare `root...` path pull
|
|
101
101
|
emits.
|
|
102
102
|
- Lookup `initialize` receives the row; lookup `apply` receives the object,
|
|
103
103
|
then the row.
|
|
104
104
|
- A `NeoLookupVariant<TObject, TValue>` member holds an unbound handle. A
|
|
105
105
|
plain `NeoVariant<TObject>` member may pick one row with
|
|
106
|
-
`.Bind(
|
|
106
|
+
`.Bind(root.Assets.Items.Index.Slug["seed.carrot"]!)`; explicit
|
|
107
|
+
`Reference(...)` remains valid. Never bind a row to the lookup-handle type.
|
|
107
108
|
|
|
108
109
|
## Type restrictions
|
|
109
110
|
|