Skip to content

Conversation

jeshecdom
Copy link
Contributor

@jeshecdom jeshecdom commented Oct 13, 2025

Closes #686. Closes #685.

Copy link

To fix the formatting issues:

  1. Install necessary dependencies: npm ci
  2. Then, run this command:
npx remark -o --silent --silently-ignore language/func/compiler-directives.mdx language/func/global-variables.mdx 

Copy link

Thanks for the updates across the FunC docs, especially in compiler directives and global variables. I found several high‑severity doc issues that should be fixed before merge.

Findings (5)

High (5)

[HIGH] Undefined placeholder in example (<path_to_filename>)

Location: https://github.com/tact-lang/mintlify-ton-docs/blob/88a284b0f8d2273953abb0505d27d1b730c7628d/language/func/compiler-directives.mdx?plain=1#L18-L19

Description:
The example introduces the placeholder <path_to_filename> in the #include syntax but does not define it on first use. Per the example conventions, placeholders must be defined where first introduced to keep snippets unambiguous and copy‑pasteable.

Suggestion:
Add a one‑line definition immediately after the code block.

 ```func
 #include "<path_to_filename>";

+<path_to_filename> — path to the FunC source file to include.


#### [HIGH] Broken internal anchor (missing leading “#”)
Location: https://github.com/tact-lang/mintlify-ton-docs/blob/88a284b0f8d2273953abb0505d27d1b730c7628d/language/func/compiler-directives.mdx?plain=1#L53-L55

Description:
The link to the “Equality and precedence” section uses `(equality-and-precedence)` without a leading `#`, producing a broken anchor. Internal section links must include the `#` to resolve to the page‑local anchor.

Suggestion:
Point the link to the local section anchor.

```diff
- than `2.3.4` (see [precedence](equality-and-precedence) and [operators](#operators) below for details).
+ than `2.3.4` (see [precedence](#equality-and-precedence) and [operators](#operators) below for details).

[HIGH] Broken self-link to “#pragma version” section

Location: https://github.com/tact-lang/mintlify-ton-docs/blob/88a284b0f8d2273953abb0505d27d1b730c7628d/language/func/compiler-directives.mdx?plain=1#L133-L134

Description:
The text links to “[#pragma version]” with an empty URL (), resulting in a broken link. It should reference the earlier “#pragma version” section on the same page.

Suggestion:
Link to the local section anchor.

- where `<op>` is an optional [version operator](#operators) that allows to specify a constraint, and `<sem_version>` is identical as 
- in [`#pragma version`]().
+ where `<op>` is an optional [version operator](#operators) that allows to specify a constraint, and `<sem_version>` is identical as 
+ in [`#pragma` version](#pragma-version).

[HIGH] Broken link with empty target

Location: https://github.com/tact-lang/mintlify-ton-docs/blob/88a284b0f8d2273953abb0505d27d1b730c7628d/language/func/compiler-directives.mdx?plain=1#L208-L209

Description:
The phrase “rearrangement of arguments” is wrapped in a link with empty parentheses [](), which renders as a broken link. Links must not have empty targets; a canonical reference exists in the Functions page.

Suggestion:
Link to the canonical Functions section.

-Here, the `asm(value index dict key_len)` notation dictates a [rearrangement of arguments]().
+Here, the `asm(value index dict key_len)` notation dictates a [rearrangement of arguments](/language/func/functions#rearranging-stack-entries).

[HIGH] Broken cross‑reference to main (invalid anchor)

Location: https://github.com/tact-lang/mintlify-ton-docs/blob/88a284b0f8d2273953abb0505d27d1b730c7628d/language/func/global-variables.mdx?plain=1#L36-L36

Description:
The link to the program entry point uses #special-functions#main, which does not exist on this page and does not match the actual anchor on the Functions page. Cross‑page anchors must point to a valid path and fragment.

Suggestion:
Link to the Functions page section.

- The example defines two auxiliary functions: `check_commutative` and `add`, in addition to the program entry point [`main`](#special-functions#main).
+ The example defines two auxiliary functions: `check_commutative` and `add`, in addition to the program entry point [`main`](/language/func/functions#special-function-names).

@anton-trunov anton-trunov linked an issue Oct 13, 2025 that may be closed by this pull request
@@ -15,7 +15,7 @@ The `#include` directive enables the inclusion of another FunC source file parse
**Syntax:**

```func
#include "filename.fc";
#include "<path_to_filename>";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it allow cyclic includes, i.e. when some file imports itself, directly or indirectly?

sidebarTitle: "Global variables"
noindex: "true"
---

A FunC program primarily consists of function declarations/definitions and global variable declarations.
This section focuses on the latter.
## Declaration
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice reference article, except it doesn't answer several key questions:

  • What does it mean for a variable to be global? (i.e. it's stored in a certain control register as part of tuple)
  • Why would someone want to make a variable global?
  • What if there are 2 global variables with the same in different files?
  • What if the same file with a global variable is included twice?


Under the hood, global variables in FunC are stored in the `c7` control register of the TVM, with a maximum limit of 31 variables.
In FunC, you can _omit the type_ of global variables. In this case, the compiler determines the type based on how the variable is used. Equivalently,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think this is applicable to arbitary variable declarations, and should just link to a corresponding section of documentation about variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not do this because local variables and global variables are completely different entities in FunC. Local variable declarations are expressions, while global variable declarations are not. There are also other differences, for example global variables can omit the type, but local variables do not allow this. So, I prefer to leave them on their own page independently one from another.

@verytactical verytactical marked this pull request as draft October 13, 2025 21:56
@jeshecdom
Copy link
Contributor Author

Included suggested fixes and some of those suggested by AI. Pending issues described in:

#863
#864

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Language > FunC] Global Variables [Language > FunC] Compiler Directives

2 participants