Skip to content
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

feat(docs): describe the limit for deeply nested expressions #1101

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Utility for logging errors in code that was supposed to be unreachable: PR [#991](https://github.com/tact-lang/tact/pull/991)
- Docs: `preloadRef` method for the `Slice` type: PR [#1044](https://github.com/tact-lang/tact/pull/1044)
- Docs: added DeDust cookbook: PR [#954](https://github.com/tact-lang/tact/pull/954)
- Docs: described the limit for deeply nested expressions: PR [#1101](https://github.com/tact-lang/tact/pull/1101)

### Changed

Expand Down
19 changes: 19 additions & 0 deletions docs/src/content/docs/book/expressions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ description: "This page lists all the expressions in Tact"

Every operator in Tact forms an expression, but there's much more to uncover as Tact offers a wide range of expressive options to choose from.

:::note

The current maximum allowed nesting level of expressions is $83$. An attempt to write a deeper expression will result in a compilation error:

```tact
fun elegantWeaponsForCivilizedAge(): Int {
return
((((((((((((((((((((((((((((((((
((((((((((((((((((((((((((((((((
(((((((((((((((((((( // 84 parens, compilation error!
42
))))))))))))))))))))
))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))));
}
```

:::

## Literals

Literals represent values in Tact. These are fixed values—not variables—that you _literally_ provide in your code. All literals in Tact are expressions themselves.
Expand Down
19 changes: 19 additions & 0 deletions docs/src/content/docs/book/operators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,25 @@ Parentheses (also can be called round brackets, `(){:tact}`) are more of a punct
5 * (5 - 2); // 15
```

:::note

The current maximum allowed nesting level of expressions is $83$. An attempt to write a deeper expression will result in a compilation error:

```tact
fun elegantWeaponsForCivilizedAge(): Int {
return
((((((((((((((((((((((((((((((((
((((((((((((((((((((((((((((((((
(((((((((((((((((((( // 84 parens, compilation error!
42
))))))))))))))))))))
))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))));
}
```

:::

## Unary

Unary here means that they are applied only to one operand of the given expression. All unary operators, except for the [non-null assertion](#unary-non-null-assert), are of the same [precedence](#precedence).
Expand Down
2 changes: 0 additions & 2 deletions docs/src/content/docs/cookbook/dexes/stonfi.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ sidebar:
order: 2
---

# STON.fi

[STON.fi](https://ston.fi) is a decentralized automated market maker (AMM) built on [TON blockchain](https://ton.org) providing virtually zero fees, low slippage, an extremely easy interface, and direct integration with TON wallets.

:::caution
Expand Down