kopular 1.1.2 → 1.1.3

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.
Files changed (2) hide show
  1. package/GUIDE.md +6 -2
  2. package/package.json +1 -1
package/GUIDE.md CHANGED
@@ -27,8 +27,12 @@ both scripts). `ks check src/app.ks` type-checks without building, if you just w
27
27
  - No implicit `this` — every member reference is `this.Field`/`this.Method()`, always,
28
28
  including inside a lambda.
29
29
  - `if`/`else`/`while`/`for`/`foreach (Type x in xs)` — all statements, no ternary. Use
30
- `match` for a conditional value: `match x { 1 => "one", _ => "other" }` (the `_` arm is
31
- required unless every case is covered, e.g. an enum).
30
+ `match` for a conditional value: `match x { "a" => "one", _ => "other" }`. **The subject
31
+ must be `string` or an `enum` — never `bool`/`number`/anything else, and every pattern
32
+ must be a string literal (or, for an enum subject, an `Enum.Member` name) — not a number,
33
+ not `true`/`false`.** The `_` arm is required unless every case is covered (only possible
34
+ for an enum subject, by naming every member). For a `bool`, use `if`/`else` instead —
35
+ there's no equivalent shorthand.
32
36
  - Lambdas need explicit parameter types: `(number x) => x * 2`.
33
37
  - Nullable: `string? name` — a nullable field forces `if (x != null) { ... }` before use;
34
38
  narrowing is scoped to that `if` block, not reachability-based (an early
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kopular",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Kopular: a small component framework for KopScript — components, reactive state, constructor-injected services, routing, real compiled templates, and HTTP, with no DI container",
5
5
  "type": "module",
6
6
  "license": "MIT",