-
Notifications
You must be signed in to change notification settings - Fork 24
feat(Fift): Words, Constants and Variables page #1472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update—languages/fift/variables.mdx: one inline suggestion to align the wording with your style guide. Please apply the inline suggestion.
| // Define word x so that it reads the box contents. | ||
| // Now, x can be treated as if | ||
| // it was the "variable". | ||
| // In other words, instead of writing "x-box @" | ||
| // to read the variable contents, simply write "x". | ||
| { x-box @ } : x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[HIGH] Banned filler word “simply” in body text
The comment explaining the getter x includes the phrase “simply write x” on these lines. The extended style guide explicitly bans filler and hedging terms like “simply” in instructional text and requires neutral, precise wording instead, so this phrasing violates a MUST-NOT rule and creates an inconsistent tone. Replacing “simply” with neutral language keeps the instruction clear while aligning with the documented style requirements, as outlined in https://github.com/ton-org/docs/blob/main/contribute/style-guide-extended.mdx?plain=1#L214-L220.
| // Define word x so that it reads the box contents. | |
| // Now, x can be treated as if | |
| // it was the "variable". | |
| // In other words, instead of writing "x-box @" | |
| // to read the variable contents, simply write "x". | |
| { x-box @ } : x | |
| // Define word x so that it reads the box contents. | |
| // Now, x can be treated as if | |
| // it was the "variable". | |
| // In other words, instead of writing "x-box @" | |
| // to read the variable contents, write "x". | |
| { x-box @ } : x |
Please leave a reaction 👍/👎 to this suggestion to improve future reviews for everyone!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
pyAndr3w
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
|
||
| ## Words | ||
|
|
||
| A _word_ is an identifier for an execution token, also known as a `WordDef`. To define a new word, first define a `WordDef` by enclosing code inside `{ }`; then invoke word `:` followed by the identifier for the word. For instance, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
phrase
identifier for an execution token, also known as a
WordDef
may be confusing after editing types.mdx
|
|
||
| ## Variables | ||
|
|
||
| _Variables_ are a much more efficient way to represent changeable values. To declare a variable, use the word `variable` followed by the identifier. Internally, the word `variable` creates an empty box, which can then be updated with word `!`, and read with word `@`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would show that variable x is the same as hole constant x and link to { hole constant } : variable in Fift.fif.
| // it inside the block/execution token. | ||
| does // Stack: { Box WordDef-for-! execute } | ||
| // Assign the block/execution token { Box WordDef-for-! execute } | ||
| // to the second string comming after the invocation of variable-get-set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix the comment typo comming > coming
| y // Top of stack has 5 | ||
| ``` | ||
|
|
||
| For more details on blocks/execution tokens and words `' <WORD_NAME>` and `execute`, refer to the Blocks Section in the Control Flow page. For more details on words `create`, `' <WORD_NAME>`, `does`, refer to Sections [4.5](/languages/fift/whitepaper#4-5-defining-words-and-dictionary-manipulation), [4.6](/languages/fift/whitepaper#4-6-dictionary-lookup), and [4.7](/languages/fift/whitepaper#4-7-creating-and-manipulating-word-lists) in the Fift whitepaper. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add link to /languages/fift/control#blocks
Closes #1467.