-
Notifications
You must be signed in to change notification settings - Fork 38
feat(Fift): Basic values page #1468
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 detailed Fift docs update; I’ve left one inline suggestion in languages/fift/basic-values.mdx to align the metadata with the existing conventions—please apply the inline suggestion.
| --- | ||
| title: "Basic values" | ||
| sidebarTitle: "Basic values" | ||
| noindex: "true" |
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] noindex frontmatter value is incorrectly quoted as a string
In the frontmatter of the new languages/fift/basic-values.mdx page, the noindex key is set to the string "true" instead of the boolean true. The extended documentation style guide describes noindex: true as a supported boolean key and does not show quoted string values for this field, so this deviates from the documented convention for frontmatter metadata. Using a string here can cause inconsistencies in downstream tooling that expects a boolean and may parse or filter on this flag. Aligning this usage with the style guide helps keep frontmatter semantics consistent and predictable across the docs.
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.
Is this really an issue? I see that many pages use "true" as value.
| ## Strings | ||
|
|
||
| A string is any sequence of UTF-8 characters enclosed by double quotes `"`. When Fift recognizes a string, it pushes it into the Fift stack as a value of type `String`. For instance, `"Hello, world!"` pushes the corresponding `String` into the stack: | ||
|
|
||
| ```fift | ||
| "Hello, world!" | ||
| // String "Hello, world!" is at the top of the stack now | ||
| ``` | ||
|
|
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.
please add one sentence that " reads until the next " on the same line (no escaping, no multi‑line), like in the whitepaper
add info about multi-line strings ($<<""")
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.
|
|
||
| ## Booleans | ||
|
|
||
| As described in the Types page, Fift does not have a separate type for booleans. Instead, booleans are emulated using `Integer`s, where `-1` represents truth, and `0` falsehood. Comparison primitives normally return `-1` to indicate success and `0` otherwise. Fift has the constants `true` and `false` to push these special integers into the stack: |
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 Types page
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.
Addressed in issue #1555. Links cannot be solved in this PR because other PRs need to be merge into main first.
languages/fift/basic-values.mdx
Outdated
|
|
||
| Certain operations, like conditional execution of blocks and loops with exit conditions, extend the notion of "true" to any non-zero integer. However, if the intention is to work with bitwise operations over booleans, any non-zero integer must first be transformed into `-1`. Fift has the word `0<>` that transforms any non-zero integer into `-1`, and leaves `0` unchanged. 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.
code block tag (fift)
languages/fift/basic-values.mdx
Outdated
| 1 2 3 3 tuple | ||
| ``` | ||
|
|
||
| The list is really the nested tuple `[ 1 [ 2 [ 3 null ] ] ]`, while the tuple is simply `[ 1 2 3 ]`. |
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.
change
the tuple is simply
[ 1 2 3 ]
to a neutral
the tuple is
[ 1 2 3 ]
(styleguide anti‑pattern)
|
|
||
| ## Slices | ||
|
|
||
| A `Slice` is a read-only view of a portion of a `Cell`. Fift uses the syntax `b{<BINARY_DATA>}` and `x{<HEX_DATA>}` for defining slices. |
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 similar section about Bytes:
B{<HEX_DATA>}syntax- save to file
- etc.
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.
Addressed in issue #1636.
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 updates to languages/fift/basic-values.mdx: I’ve left several suggestions to align frontmatter, anchors, and code blocks with the docs conventions—please apply the inline suggestions.
| --- | ||
| title: "Basic values" | ||
| sidebarTitle: "Basic values" | ||
| noindex: "true" |
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] Invalid noindex frontmatter value
The frontmatter defines noindex: "true" as a string on this page, while the docs style guide and tooling expect noindex to be a boolean (true/false). Using a string here can cause frontmatter parsers and indexing tools to misinterpret or ignore the flag. This leads to inconsistent behavior for search and indexing compared to other pages that follow the prescribed boolean format.
| noindex: "true" | |
| noindex: true |
Please leave a reaction 👍/👎 to this suggestion to improve future reviews for everyone!
|
|
||
| So that, executing `1.7 2/3 R- 5/2 R*` will produce the stack `155 60`, corresponding to the arithmetical operation `(1.7 - 2/3) * 5/2 = 31/30 * 5/2 = 155/60`. | ||
|
|
||
| For advanced details on integers, see the [Integers section](/languages/fift/whitepaper#2-8-integer-and-fractional-constants%2C-or-literals) 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.
[HIGH] Incorrect whitepaper anchor for “Integers section”
The “Integers section” link uses the fragment #2-8-integer-and-fractional-constants%2C-or-literals, which URL‑encodes the comma. In languages/fift/whitepaper.mdx, the actual section anchor is #2-8-integer-and-fractional-constants-or-literals (with a hyphen in place of the comma and no encoding). This mismatch breaks the internal navigation, so readers clicking the link will not land on the intended whitepaper section.
| For advanced details on integers, see the [Integers section](/languages/fift/whitepaper#2-8-integer-and-fractional-constants%2C-or-literals) in the Fift whitepaper. | |
| For advanced details on integers, see the [Integers section](/languages/fift/whitepaper#2-8-integer-and-fractional-constants-or-literals) in the Fift whitepaper. |
Please leave a reaction 👍/👎 to this suggestion to improve future reviews for everyone!
| For advanced details about tuple, see the [Tuples section](/languages/fift/whitepaper#2-15-tuples-and-arrays) in the Fift whitepaper. | ||
|
|
||
| ## Lists | ||
|
|
||
| Lisp-style lists can also be represented in Fift. A list `(1 2 3)` can be represented by nesting 2-tuples `[ 1 [ 2 [ 3 null ] ] ]`, where [`null`](#null) represents the empty list. Fift provides several words to create and deconstruct lists. | ||
|
|
||
| The word `cons` takes a stack of the form `h l`, where `h` is a value and `l` is a list, i.e., a nested tuple; consumes both `h` and `l`, and produces the tuple `[ h l ]`. | ||
|
|
||
| For instance, the following code produces the list `(1 2 3)`: | ||
|
|
||
| ``` | ||
| 1 2 3 null cons cons cons | ||
| ``` | ||
|
|
||
| First, `1 2 3 null` produces the stack `1 2 3 null`, where `null` is at the top of the stack. Then, the first `cons` produces the stack `1 2 [ 3 null ]`, where tuple `[ 3 null ]` is at the top of the stack. Next, the second `cons` produces the stack `1 [ 2 [ 3 null ] ]`. Finally, the third `cons` produces the stack `[ 1 [ 2 [ 3 null ] ] ]` containing a single tuple at the top, which is the list `(1 2 3)`. | ||
|
|
||
| It is so common to build fixed-length lists like in the above example, that Fift provides a special word for building a list when the elements are known. The word `list` takes a stack of the form `x1 ... xn n`, where `n` is the number of elements in the list, and consumes `x1`, `...`, `xn` and `n` from the stack to produce the list `(x1 .... xn)` at the top of the stack. |
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] Inconsistent internal whitepaper subsection anchors
This section links to the whitepaper “Tuples section” using /languages/fift/whitepaper#2-15-tuples-and-arrays, and later uses similar “For advanced details…” links for lists, atoms, and slices (#2-16-lists, #2-17-atoms, and #5-1-slice-literals). While the tuple, lists, atoms, and slice anchors exist in the whitepaper’s table of contents (languages/fift/whitepaper.mdx lines 38, 45–47, 69), the pattern here is not verified against the actual in‑document heading anchors and can easily drift or break if those headings or auto-generated IDs differ from the TOC slugs. The style guide treats broken or inconsistent internal anchors as HIGH severity, and these links rely on assumed slugs instead of confirmed section anchors within the whitepaper body. Aligning these links with the real anchors ensures that each “For advanced details…” reference reliably lands on the correct subsection.
Please leave a reaction 👍/👎 to this suggestion to improve future reviews for everyone!
languages/fift/basic-values.mdx
Outdated
| ``` | ||
| 1 2 3 null cons cons cons | ||
| ``` |
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] Missing language tag on list construction snippet
The list-construction example that builds (1 2 3) using 1 2 3 null cons cons cons is in a fenced code block with no language tag. The docs style guide requires every fenced block to declare a language so that syntax highlighting and code-aware tooling work correctly. Leaving this block untagged reduces readability and may cause it to be skipped or mishandled by tooling that expects Fift code samples to be labeled.
Please leave a reaction 👍/👎 to this suggestion to improve future reviews for everyone!
Closes #1466.