Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

feat: big update, Language→Reference #206

Merged
merged 26 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a241764
chore: Started the big move
novusnota Apr 8, 2024
65fb5d4
chore: Fix internal linkage
novusnota Apr 8, 2024
ee7fe04
chore: Update redirects
novusnota Apr 9, 2024
fcff4bc
feat: Language->Reference, a big update!
novusnota Apr 29, 2024
e6b82ce
Merge branch 'main' into language/reference
novusnota Apr 29, 2024
b4961a7
wip: intermediate commit
novusnota May 11, 2024
4afd8bf
feat: finished api-strings
novusnota May 12, 2024
2e8fa52
feat: finished api-random
novusnota May 12, 2024
6e5aa5e
feat: api-math and couple of more
novusnota May 13, 2024
0362b9d
feat: api-common
novusnota May 14, 2024
5aaaea5
Merge branch 'main' into language/reference
novusnota May 14, 2024
b7fa4d1
feat: api-debug
novusnota May 14, 2024
23c5d77
feat: api-advanced
novusnota May 14, 2024
431fd40
chore: Apply basic suggestions from code review
novusnota May 14, 2024
109ac86
chore: forward fee
novusnota May 14, 2024
3ad336a
chore: couple fixes
novusnota May 15, 2024
21fd8e0
chore: "API Reference" is now called "Core library" for clarity
novusnota May 15, 2024
4e40daf
fix: explain `require()` better
novusnota May 16, 2024
3949cfa
fix: core-math stuff
novusnota May 16, 2024
f81c12f
chore: "more gas-efficient" over "less gas-consuming"
novusnota May 17, 2024
80450f7
chore: correct the bug
novusnota May 17, 2024
68c039b
chore: placed less used functions lower
novusnota May 17, 2024
b9bd0ac
chore: more about the context and emit
novusnota May 17, 2024
92dcd71
chore: almost nothing throws for core-string
novusnota May 17, 2024
92203b0
feat: done!
novusnota May 20, 2024
b1eb045
fix: clarify
novusnota May 20, 2024
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
4 changes: 2 additions & 2 deletions pages/_meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export default {
title: "Cookbook",
type: 'page',
},
language: {
title: "Language",
ref: {
title: "Reference",
type: 'page',
},
ecosystem: {
Expand Down
6 changes: 3 additions & 3 deletions pages/book/import.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Callout } from 'nextra-theme-docs'

Tact allows you to import Tact and [FunC](https://docs.ton.org/develop/func/overview) code — any given `.tact` or `.fc`/`.func` file can be imported into your project using an `import{:tact}` keyword.

Additionally, Tact compiler has a versatile set of standard libraries, which come bundled in, but not included right away, see [Language→Libs→Overview](/language/libs/overview).
Additionally, Tact compiler has a versatile set of standard libraries, which come bundled in, but not included right away, see [Standard libraries overview](/ref/standard-libraries).

<Callout type="warning" emoji="⚠️">
NOTE: All imported code is combined together with yours, so it's important to avoid name collisions and always double-check the sources!
Expand Down Expand Up @@ -36,7 +36,7 @@ import "./relative/path/to/the/target/func/file.fc";
import "../subfolder/imported/func/file.fc";
```

But in order to use functions from such file, one has to declare them as `native` functions first. For example, when standard library [@stdlib/dns](/language/libs/dns) uses a `dns.fc` FunC file, it maps FunC functions to Tact ones like so:
But in order to use functions from such file, one has to declare them as `native` functions first. For example, when standard library [@stdlib/dns](/ref/stdlib-dns) uses a `dns.fc` FunC file, it maps FunC functions to Tact ones like so:

```tact
// FunC code located in a file right next to the current Tact one:
Expand All @@ -49,4 +49,4 @@ native dnsStringToInternal(str: String): Slice?;

## Standard libraries

See [Language→Libs→Overview](/language/libs/overview).
See [Standard libraries overview](/ref/standard-libraries).
4 changes: 2 additions & 2 deletions pages/book/index.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Book Overview
# Book overview

import { Cards, Steps } from 'nextra/components'

Welcome to **The Tact Book** section (or just **The Book**), — an introductory book about the Tact language.

Here are it's main contents:
Here are its main contents:

<Steps>

Expand Down
2 changes: 1 addition & 1 deletion pages/book/integers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Use underscores (`_`) to improve readability: $\mathrm{0b111\_111\_111}$ is equa

For example, arithmetic with dollars requires two decimal places after the dot — those are used for the cents value. But how would we represent the number \$$1.25$ if we're only able to work with integers? The solution is to work with _cents_ directly. This way, \$$1.25$ becomes $125$ cents. We simply memorize that the two rightmost digits represent the numbers after the decimal point.

Similarly, working with Toncoins requires nine decimal places instead of the two. Therefore, the amount of $1.25$ TON, which can be represented in Tact as [`ton("1.25"){:tact}`](/language/ref/common#ton), is actually the number $1250000000$. We refer to such numbers as _nano-tons_ (or _nanoToncoins_) rather than _cents_.
Similarly, working with Toncoins requires nine decimal places instead of the two. Therefore, the amount of $1.25$ TON, which can be represented in Tact as [`ton("1.25"){:tact}`](/ref/api-comptime#ton), is actually the number $1250000000$. We refer to such numbers as _nano-tons_ (or _nanoToncoins_) rather than _cents_.

## Serialization

Expand Down
4 changes: 2 additions & 2 deletions pages/book/types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Tact doesn't support classical class inheritance, but instead introduces the con

A trait can also let the contract inheriting it to override the behavior of its [functions](/book/functions#virtual-and-abstract-functions) and the value of its [constants](/book/constants#virtual-and-abstract-constants).

Example of a trait [`Ownable`](/language/libs/ownable#ownable) from [`@stdlib/ownable`](/language/libs/ownable):
Example of a trait [`Ownable{:tact}`](/ref/stdlib-ownable#ownable) from [`@stdlib/ownable`](/ref/stdlib-ownable):

```tact
trait Ownable {
Expand All @@ -159,7 +159,7 @@ trait Ownable {
}
```

And the [contract](#contracts) that uses trait [`Ownable`](/language/libs/ownable#ownable):
And the [contract](#contracts) that uses trait [`Ownable{:tact}`](/ref/stdlib-ownable#ownable):

```tact
contract Treasure with Ownable {
Expand Down
2 changes: 1 addition & 1 deletion pages/cookbook/index.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Cookbook Overview
# Cookbook overview

import { Callout, Steps, Cards } from 'nextra/components'
import { OneIcon, FormulaIcon, DiagramIcon, DropperIcon, BoxIcon, IdCardIcon, WarningIcon, StarsIcon, RowsIcon, GearIcon, LightningIcon } from '@components/icons'
Expand Down
2 changes: 1 addition & 1 deletion pages/cookbook/misc.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ nativeThrowUnless(39, number == 198);
<Callout>

**Useful links:**\
[`throw(){:tact}` in Language→Reference](/language/ref/advanced#throw)\
[`throw(){:tact}` in Core library](/ref/core-debug#throw)\
[Errors in Tact-By-Example](https://tact-by-example.org/03-errors)

</Callout>
Expand Down
4 changes: 2 additions & 2 deletions pages/cookbook/random.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ number = random(1, 12);
<Callout>

**Useful links:**\
[`randomInt(){:tact}` in Language→Reference](/language/ref/random#randomInt)\
[`random(){:tact}` in Language→Reference](/language/ref/random#random)
[`randomInt(){:tact}` in Core library](/ref/core-random#randomInt)\
[`random(){:tact}` in Core library](/ref/core-random#random)

</Callout>

Expand Down
2 changes: 1 addition & 1 deletion pages/cookbook/single-communication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ send(SendParameters{
["Sending messages" in the Book](/book/send#send-message)\
["Message `mode`" in the Book](/book/message-mode)
[`StringBuilder{:tact}` in the Book](/book/types#primitive-types)\
[`Cell{:tact}` in Language→Reference](/language/ref/cells)
[`Cell{:tact}` in Core library](/ref/core-cells)

</Callout>

Expand Down
2 changes: 1 addition & 1 deletion pages/cookbook/time.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (currentTime > 1672080143) {
<Callout>

**Useful links:**\
[`now(){:tact}` in Language→Reference](/language/ref/common#now)\
[`now(){:tact}` in Core library](/ref/core-common#now)\
["Current Time" in Tact-By-Example](https://tact-by-example.org/04-current-time)

</Callout>
Expand Down
6 changes: 3 additions & 3 deletions pages/cookbook/type-conversion.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ dump(coinsString); // "0.261119911"
<Callout>

**Useful links:**\
[`Int.toString(){:tact}` in Language→Reference](/language/ref/strings#inttostring)\
[`Int.toFloatString(){:tact}` in Language→Reference](/language/ref/strings#inttofloatstring)\
[`Int.toCoinsString(){:tact}` in Language→Reference](/language/ref/strings#inttocoinsstring)
[`Int.toString(){:tact}` in Core library](/ref/core-strings#inttostring)\
[`Int.toFloatString(){:tact}` in Core library](/ref/core-strings#inttofloatstring)\
[`Int.toCoinsString(){:tact}` in Core library](/ref/core-strings#inttocoinsstring)

</Callout>

Expand Down
6 changes: 3 additions & 3 deletions pages/ecosystem/index.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Overview
# Ecosystem overview

import { Cards, Steps } from 'nextra/components'

Welcome to the **Ecosystem** section — a bird-eye overview of Tact ecosystem, tools and ways you can start contributing to those!

Here are it's main contents:
Here are its main contents:

<Steps>

Expand All @@ -20,4 +20,4 @@ Here are it's main contents:
/>
</Cards>

</Steps>
</Steps>
8 changes: 4 additions & 4 deletions pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ For custom plugins for your favorite editor and other tooling see the [Tools](/e
Alternatively, take a look at the following broader sections:
* [Book](/book) helps you learn the language step-by-step
* [Cookbook](/cookbook) gives you ready-made recipes of Tact code
* [Language](/language) provides a complete reference of the standard library, grammar and evolution process
* [Reference](/ref) provides a complete glossary of the standard library, grammar and evolution process
* Finally, [Ecosystem](/ecosystem) describes "what's out there" in the Tacts' and TONs' ecosystems

<Cards>
Expand All @@ -120,13 +120,13 @@ Alternatively, take a look at the following broader sections:
/>
<Cards.Card
icon="🍲 "
title="Examine the Cookbook"
title="Grind the Cookbook"
href="/cookbook"
/>
<Cards.Card
icon="🔬 "
title="Study the Language"
href="/language"
title="Skim the Reference"
href="/ref"
/>
<Cards.Card
icon="🗺️ "
Expand Down
20 changes: 0 additions & 20 deletions pages/language/_meta.js

This file was deleted.

59 changes: 0 additions & 59 deletions pages/language/index.mdx

This file was deleted.

9 changes: 0 additions & 9 deletions pages/language/libs/_meta.js

This file was deleted.

32 changes: 0 additions & 32 deletions pages/language/libs/overview.mdx

This file was deleted.

8 changes: 0 additions & 8 deletions pages/language/ref/_meta.js

This file was deleted.

Loading
Loading