@neocompose/cli 0.77.0 → 0.77.1
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 +38 -0
- package/dist/neo.mjs +1282 -533
- package/dist/test-worker.mjs +517 -268
- 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/declarations-and-construction.md +21 -2
- package/skills/neocompose-cli/references/neoscript.md +9 -0
package/package.json
CHANGED
|
@@ -129,7 +129,7 @@ wrappers.
|
|
|
129
129
|
The marker near the top of `SKILL.md` must exactly match the package version:
|
|
130
130
|
|
|
131
131
|
```html
|
|
132
|
-
<!-- reviewed-through-cli: 0.77.
|
|
132
|
+
<!-- reviewed-through-cli: 0.77.1 -->
|
|
133
133
|
```
|
|
134
134
|
|
|
135
135
|
The quoted version above is checked too, so this instruction cannot go stale
|
|
@@ -213,6 +213,19 @@ An explicit construction must be assignable to its receiving type. For example,
|
|
|
213
213
|
`List<Base>` accepts `new Derived()` when `Derived` inherits `Base`, but rejects
|
|
214
214
|
an unrelated class at `new`. Generic arguments must also be compatible.
|
|
215
215
|
|
|
216
|
+
A generic class without a declared constructor is constructed with its type
|
|
217
|
+
arguments, such as `new Box<int> { Item = 4 }` or a target-typed
|
|
218
|
+
`new() { Item = 4 }`. A `T` field is required unless the type argument is
|
|
219
|
+
nullable, so `new Box<int?>()` may omit it. `new Box()` is rejected as an open
|
|
220
|
+
generic Class. Inside the class, methods and field initializers construct with
|
|
221
|
+
the class's own parameter, such as `public Bag<T> B = new Bag<T>();`. Such an
|
|
222
|
+
initializer with fields or entries, like `new Bag<T> { N = 3 }`, runs per
|
|
223
|
+
instance, since each instance closes `T` differently. A type
|
|
224
|
+
argument that wraps the parameter, such as `new Bag<List<T>>()`, is rejected.
|
|
225
|
+
Type arguments must satisfy `extends` constraints in bodies too.
|
|
226
|
+
A type argument may be a delegate, such as `Box<NeoDelegate<int, int>>`, but
|
|
227
|
+
not a `NeoAction`, which is never a value.
|
|
228
|
+
|
|
216
229
|
Primary-constructor parameters can initialize generic collection fields directly:
|
|
217
230
|
|
|
218
231
|
```neo
|
|
@@ -221,7 +234,8 @@ class Box<T>(List<T> value) {
|
|
|
221
234
|
}
|
|
222
235
|
```
|
|
223
236
|
|
|
224
|
-
The same rule applies to `Dictionary<string, T
|
|
237
|
+
The same rule applies to `Dictionary<string, T>`, nested collections, and
|
|
238
|
+
stored instances such as `public static Box<int> Value = new([1, 2]);`.
|
|
225
239
|
|
|
226
240
|
## Member and relation rules
|
|
227
241
|
|
|
@@ -410,7 +424,12 @@ class Foo(string bar, bool isFun) {
|
|
|
410
424
|
Foo value = new(bar: "BAR", isFun: true) { IsFun = false };
|
|
411
425
|
```
|
|
412
426
|
|
|
413
|
-
Header parameters are in scope throughout the
|
|
427
|
+
Header parameters are in scope throughout the instance members of the class.
|
|
428
|
+
Field initializers, collection entries, object initializers, and lambdas read
|
|
429
|
+
them per construction, so `public NeoDelegate<int> Value = () => n;` returns
|
|
430
|
+
each instance's own `n`. A lambda can also read `this`, as in
|
|
431
|
+
`() => n + this.M`; the rest of an initializer can't. Static members have no
|
|
432
|
+
construction and can't read header parameters. Permit at most one `init`
|
|
414
433
|
block. A header constructor disables implicit parameterless `new` and forbids
|
|
415
434
|
additional constructor overloads. Its derived constructor identity is not
|
|
416
435
|
authored with `@id`.
|
|
@@ -137,6 +137,15 @@ Other static fields can call them in their initializers, as in
|
|
|
137
137
|
`public static int First = Helper.Run();`. Outside a lambda body, a field
|
|
138
138
|
initializer qualifies the members it reads; a bare `Run()` or `Number` there is
|
|
139
139
|
an unknown name.
|
|
140
|
+
A delegate field default is the exception: it may name a method group bare.
|
|
141
|
+
`Value = Read` or `this.Read` binds each new instance to its own `Read`, and a
|
|
142
|
+
static function may be named as `Read` or qualified as `Holder.Read`/`Other.Read`.
|
|
143
|
+
A qualified method group must name a static function. Method groups use the same
|
|
144
|
+
signature rule as in a body, and a mismatch is reported at the declaration.
|
|
145
|
+
A static field that names another static copies a value, as in
|
|
146
|
+
`public static int B = Holder.A;`; a class, List, or Dictionary static shares
|
|
147
|
+
the same object. A static delegate cannot copy another Class's delegate field,
|
|
148
|
+
because its closure compiles in its own Class; wrap it as `() => Other.Call()`.
|
|
140
149
|
Collection type arguments in constructions, such as `new Box<List<int>>([1, 2])`,
|
|
141
150
|
work even when no field declares that collection type. Preparation includes the
|
|
142
151
|
needed type descriptors; spec-only types remain in the test candidate.
|