Skip to content

docs: fix bare reassignment examples to match compiler behavior#1

Merged
otnc merged 1 commit into
mainfrom
fix/bare-reassignment-examples
Jul 14, 2026
Merged

docs: fix bare reassignment examples to match compiler behavior#1
otnc merged 1 commit into
mainfrom
fix/bare-reassignment-examples

Conversation

@otnc

@otnc otnc commented Jul 14, 2026

Copy link
Copy Markdown
Member

Summary

Bare identifier reassignment (y be 20) is not supported per the RFC (6.4 Assignment) and becomes a compile error with puruslang/purus#8 — but several docs examples still used it. Until now those examples silently dropped the assignment at compile time (the while-loop examples actually infinite-looped when run).

Changes (en + ja)

Page Before After
reference/operators — Assignment y be 20 shown as valid removed; caution added pointing to property/index/destructuring targets and compound assignment
reference/control-flow — While i be i add 1 i add be 1
reference/functions — Generators i be i add 1 i add be 1
getting-started/hello-world — Variables y be 100 y add be 1

Not changed (verified against the compiler)

  • for let i be 0; i lt 5; i be i add 1 — the for-loop update clause is special-cased by the parser and compiles correctly to i = i + 1
  • [a; b] be [b; a] destructuring swap — works
  • keywords/syntax pages already document bare assignment as an error

Related: puruslang/purus#5, puruslang/purus#8

Bare identifier reassignment (`y be 20`) is not supported (RFC 6.4)
and is now reported as a compile error (puruslang/purus#8), but several
examples still used it — those examples silently dropped the
assignment (the while loops would infinite-loop):

- reference/operators: remove `y be 20` from Assignment; add a caution
  pointing to property/index/destructuring targets and compound
  assignment
- reference/control-flow: while example `i be i add 1` -> `i add be 1`
- reference/functions: generator example `i be i add 1` -> `i add be 1`
- getting-started/hello-world: `y be 100` -> `y add be 1`

The for-loop update clause (`for let i be 0; i lt 5; i be i add 1`)
is special-cased by the parser and remains valid, so those examples
are unchanged. Both en and ja pages updated.
@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jul 14, 2026 4:53am

@otnc otnc merged commit d4218b2 into main Jul 14, 2026
3 checks passed
@otnc otnc deleted the fix/bare-reassignment-examples branch July 14, 2026 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant