@sweetener/cli 0.1.0-alpha.2 → 0.1.0-alpha.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/SKILL.md +20 -5
  2. package/package.json +2 -2
package/SKILL.md CHANGED
@@ -139,10 +139,12 @@ export const pair = twice(21);
139
139
 
140
140
  export operator (|>):expr {
141
141
  fixity infix;
142
- associativity left;
143
- precedence 40;
144
- rule { $value:expr |> $body:expr } => {
145
- ((topic) => #parameterize(% = topic) { $body })($value)
142
+ associativity right;
143
+ precedence 20;
144
+ rule { $value:expr |> $body:expr }
145
+ refine $body form not in (conditional, arrow, assignment, yield);
146
+ => {
147
+ #let(topic = $value) { #parameterize(required % = topic) { $body } }
146
148
  }
147
149
  }
148
150
  ```
@@ -153,7 +155,20 @@ export const pair = twice(21);
153
155
  operands is still remainder. Hygiene alone cannot do this, because the `%`
154
156
  was written by the user and `topic` by the template. A parameter may have
155
157
  rules, used where no `#parameterize` names it; one without rules is reported
156
- there.
158
+ there. `required` reports a body that never uses the parameter.
159
+
160
+ - **A value used more than once, evaluated once**: `#let(name = $value) { body }`.
161
+ It becomes `((name) => body)(value)`, unless the body has an `await` or
162
+ `yield` of its own, which cannot move into a function; then it assigns a
163
+ variable declared in the enclosing function instead. Prefer it to writing the
164
+ arrow yourself, which breaks `await` in the body.
165
+ - **An expression of a particular form**: `refine $body form not in (conditional,
166
+ arrow, assignment, yield, await)` refuses those forms unparenthesized, and
167
+ `form in (...)` accepts only them.
168
+ - **An operator whose right side is not an expression**: a rule may spell it
169
+ literally, `rule { $value:expr |> await } => { await $value }`, and
170
+ `operand arrow;` lets an unparenthesized arrow stand there, ending at the next
171
+ use of the operator: `x |> n => n + 1 |> f`.
157
172
 
158
173
  - **A name that begins with `$`** (`$inferSelect`, `$state`): write `$$` for
159
174
  the `$`, as in `typeof $table.$$inferSelect`. `$name` alone is a capture, in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sweetener/cli",
3
- "version": "0.1.0-alpha.2",
3
+ "version": "0.1.0-alpha.3",
4
4
  "description": "Sweetener alpha package: cli",
5
5
  "type": "module",
6
6
  "exports": {
@@ -39,7 +39,7 @@
39
39
  "SKILL.md"
40
40
  ],
41
41
  "dependencies": {
42
- "@sweetener/compiler": "0.1.0-alpha.2",
42
+ "@sweetener/compiler": "0.1.0-alpha.3",
43
43
  "typescript": "npm:@typescript/typescript6@6.0.2"
44
44
  },
45
45
  "engines": {