Skip to content

Commit 0720034

Browse files
hyperpolymathclaude
andcommitted
docs: rebut false claims about missing language features
Spread operators, if-expressions in let bindings, and struct updates all exist in the parser. The reporter used JavaScript/Haskell syntax instead of AffineScript's Rust-style syntax. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 57fb6cf commit 0720034

1 file changed

Lines changed: 58 additions & 1 deletion

File tree

REPLY-SUM-TYPES.md

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,64 @@ handles sum types end-to-end.
173173

174174
---
175175

176-
## Appendix: Feature Coverage Matrix
176+
## Appendix B: Rebuttal — "Missing Features" Claim
177+
178+
A separate report claimed AffineScript lacks spread operators, if-expressions in
179+
assignments, and concise struct updates. All three claims are **incorrect**.
180+
181+
### "No Spread Operator Support" — FALSE
182+
183+
The parser supports record spread syntax (`parser.mly` lines 481, 527-528):
184+
185+
```affinescript
186+
// Record spread (struct update) — Rust-style `..` not JS-style `...`
187+
let updated = { health: 100, ..original_player }
188+
```
189+
190+
The syntax is `{ field: value, ..base_expr }`. The claim used JavaScript's
191+
`{...obj}` syntax (triple-dot), which is not AffineScript syntax.
192+
193+
**Evidence:** `record_spread: | COMMA DOTDOT e = expr { e }` in parser.mly:527-528.
194+
195+
### "let x = if...else... Fails to Parse" — FALSE
196+
197+
`if` is an expression (`parser.mly` line 488-489) and `let` accepts any expression
198+
as its value (`parser.mly` line 495-497):
199+
200+
```affinescript
201+
// This works — if is an expression
202+
let x = if condition { value_a } else { value_b }
203+
204+
// This also works with else-if chains
205+
let x = if a { 1 } else if b { 2 } else { 3 }
206+
```
207+
208+
The `if` branches require **block syntax** `{ }` — not bare expressions. Writing
209+
`let x = if cond then a else b` (ML/Haskell style) will fail because AffineScript
210+
uses Rust-style blocks. This is by design, not a limitation.
211+
212+
### "Verbose Struct Updates" — FALSE (same as spread)
213+
214+
Record spread IS the struct update syntax:
215+
216+
```affinescript
217+
// Update one field, keep everything else
218+
let new_state = { score: state.score + 10, ..state }
219+
220+
// Update multiple fields
221+
let healed = { health: 100, status: Status::Alive, ..player }
222+
```
223+
224+
No manual field copying required.
225+
226+
### Root Cause
227+
228+
These are **documentation gaps**, not language limitations. The reporter appears to
229+
have tried JavaScript/Haskell syntax in a Rust-influenced language.
230+
231+
---
232+
233+
## Appendix A: Feature Coverage Matrix
177234

178235
| Capability | Parser | AST | Resolver | Interpreter | WASM Codegen |
179236
|------------|--------|-----|----------|-------------|--------------|

0 commit comments

Comments
 (0)