docs: fix bare reassignment examples to match compiler behavior#1
Merged
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)
y be 20shown as validi be i add 1i add be 1i be i add 1i add be 1y be 100y add be 1Not 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 toi = i + 1[a; b] be [b; a]destructuring swap — worksRelated: puruslang/purus#5, puruslang/purus#8