-
Notifications
You must be signed in to change notification settings - Fork 24
feat(Fift): Types page #1426
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?
feat(Fift): Types page #1426
Changes from all commits
c5c821c
dfa1dbd
09e224a
0a73e93
3d18679
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| --- | ||
| title: "Types" | ||
| sidebarTitle: "Types" | ||
| noindex: "true" | ||
| --- | ||
|
|
||
| import { Aside } from '/snippets/aside.jsx'; | ||
|
|
||
| The Fift stack can contain values of the following types: | ||
|
|
||
| | | | | ||
| | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | `Integer` | A TVM signed 257-bit integer. | | ||
| | `Cell` | A [TVM cell](/foundations/serialization/cells) for persistent data storage on TON Blockchain. A cell consists of up to `1023` data bits and up to `4` references to other cells. | | ||
| | `Slice` | A TVM slice is a read-only view of a TVM cell that allows sequential access to the cell's data and references. A cell can be converted into a slice, extracting stored bits and references without modifying the original cell. | | ||
| | `Builder` | A TVM builder is used to construct a cell by adding data and cell references. | | ||
| | `Null` | The TVM Null type has exactly one value `null`. In Fift, `null` is mostly used to initialize `Box`'es, hashmaps and lists. Usually denoted by `⊥`. | | ||
| | `Tuple` | A tuple is an ordered collection of values of any of the Fift types in this list, where each value is not necessarily of the same type. Tuples can be used to represent values of arbitrary algebraic data types and Lisp-style lists. | | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe keep a short description (for Tuple) in the table and move algebraic types and Lisp list details into text below. |
||
| | `Continuation` | A [TVM continuation](/tvm/continuations) employed for execution of [TVM code](/tvm/instructions). | | ||
| | `String` | An UTF-8 string. | | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use |
||
| | `Bytes` | An arbitrary sequence of 8-bit bytes, typically used to represent binary data. | | ||
| | `Box` | A container occupying one stack slot, that can be used to store one value of any type. Usually used to represent variables and mutable data structures. | | ||
| | `Atom` | A simple entity uniquely identified by its name. Can be used to represent identifiers, labels, operation names, tags, and stack markers. | | ||
| | `Object` | An arbitrary C++ object. Entities like word lists, execution tokens and Fift hashmaps are represented as having the type `Object`. This type may also be used by Fift extensions to manipulate other data types and interface with other C++ libraries. | | ||
|
|
||
| The first seven types listed above are shared with TVM; the remainder are Fift-specific. | ||
|
|
||
| <Aside | ||
| title="No boolean type" | ||
| > | ||
| There is no dedicated `Boolean` type. Instead, booleans are represented as integers: | ||
|
|
||
| - "false" is `0`, "true" is `-1`, a 257-bit integer with all bits set to `1`. | ||
| - Logical operations are performed using bitwise operations. | ||
| - In conditional execution of blocks and loops with exit conditions, any nonzero integer in the conditions is regarded as "true". | ||
| </Aside> | ||
|
|
||
| <Aside | ||
| title="The Object type" | ||
| > | ||
| Many entities in Fift do not have a dedicated type, but they are assigned type `Object`. Fift provides words for creating and manipulating these entities. Examples of entities of type `Object`: | ||
|
|
||
| - Word list: A partially created list of word references, used for creating an execution token. See section for Blocks in the Control Flow page. See also Section [4.7](https://localhost:3000/languages/fift/whitepaper#4-7-creating-and-manipulating-word-lists) in the whitepaper for a list of words that create and manipulate word lists. | ||
| - Execution token: Fift code that can be executed and manipulated on the Fift stack. See section for Blocks in the Control Flow page for more details. | ||
| - Fift hashmap: A hashmap specific for Fift. These hashmaps are not represented as cells, contrary to TVM hashmaps. Refer to Fift hashmaps page for more details. As a comparison with TVM hashmaps, refer to Section [6.3](https://localhost:3000/languages/fift/whitepaper#6-3-dictionary-manipulation) in the whitepaper for a list of words that create and manipulate TVM hashmaps. | ||
|
Comment on lines
+43
to
+45
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please switch localhost links to relative ones and add link to
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
?? |
||
| </Aside> | ||
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.
can we add column headers
Type | Description, like intvm/overview.mdx?