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

Commit 9d84f66

Browse files
authored
chore: highlighting-related housekeeping (#238)
* chore: highlighting-related housekeeping * Capitalized type letters in `map<k, v>` to be `map<K, V>` * Added `()` after any reference to a function name * Prefixed things in `core-base.mdx` with `self.` * Various smaller corrections, like removal of highlighting for "bitwise OR" literally (not to be confused with highlighting of the operator `|`) Closes #195
1 parent 747b3c1 commit 9d84f66

13 files changed

+24
-24
lines changed

pages/book/bounced.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Currently, bounced messages in TON have only 224 usable data bits in the message
1616

1717
</Callout>
1818

19-
To receive a bounced message, define a `bounced` [receiver function](/book/contracts#receiver-functions) in your [contract](/book/contracts) or a [trait](/book/types#traits):
19+
To receive a bounced message, define a `bounced(){:tact}` [receiver function](/book/contracts#receiver-functions) in your [contract](/book/contracts) or a [trait](/book/types#traits):
2020

2121
```tact {2-4}
2222
contract MyContract {

pages/book/contracts.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ contract Example {
4646
}
4747
```
4848

49-
State variables must have a default value or initialized in [`init(){:tact}`](#init-function) function, that runs on deployment of the contract. The only exception is persistent state variables of type [`map<k, v>{:tact}`](/book/maps) since they are initialized empty by default.
49+
State variables must have a default value or initialized in [`init(){:tact}`](#init-function) function, that runs on deployment of the contract. The only exception is persistent state variables of type [`map<K, V>{:tact}`](/book/maps) since they are initialized empty by default.
5050

5151
<Callout>
5252

pages/book/maps.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { Callout } from 'nextra/components'
44

5-
The [composite type](/book/types#composite-types) `map<k, v>{:tact}` is used as a way to associate keys of type `k` with corresponding values of type `v`.
5+
The [composite type](/book/types#composite-types) `map<K, V>{:tact}` is used as a way to associate keys of type `K{:tact}` with corresponding values of type `V{:tact}`.
66

77
For example, `map<Int, Int>{:tact}` uses [`Int{:tact}`][int] type for its keys and values:
88

@@ -50,7 +50,7 @@ contract Example {
5050
}
5151
```
5252

53-
Note, that [persistent state variables](/book/contracts#variables) of type `map<k, v>{:tact}` are initialized empty by default and don't need default values or an initialization in the [`init(){:tact}` function](/book/contracts#init-function).
53+
Note, that [persistent state variables](/book/contracts#variables) of type `map<K, V>{:tact}` are initialized empty by default and don't need default values or an initialization in the [`init(){:tact}` function](/book/contracts#init-function).
5454

5555
### Set values, `.set()` [#set]
5656

@@ -199,7 +199,7 @@ foreach (key, value in fizz) {
199199

200200
Read more about it: [`foreach{:tact}` loop in Book→Statements](/book/statements#foreach-loop).
201201

202-
Note, that it's also possible to use maps as simple arrays if you define a `map<Int, V>{:tact}` with an [`Int{:tact}`][int] type for the keys, any allowed `V` type for values and keep track of the number of items in the separate variable:
202+
Note, that it's also possible to use maps as simple arrays if you define a `map<Int, V>{:tact}` with an [`Int{:tact}`][int] type for the keys, any allowed `V{:tact}` type for values and keep track of the number of items in the separate variable:
203203

204204
```tact
205205
contract Iteration {

pages/book/message-mode.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ $+32$ | `SendDestroyIfZero{:tact}` | Current account must be destroyed
2525

2626
## Combining modes with flags
2727

28-
To make the [`Int{:tact}`][int] value for `mode` field of `SendParameters{:tact}`, you just have to combine base modes with optional flags by applying the [`bitwise OR{:tact}`](/book/operators#binary-bitwise-or) operation.
28+
To make the [`Int{:tact}`][int] value for `mode` field of `SendParameters{:tact}`, you just have to combine base modes with optional flags by applying the [bitwise OR](/book/operators#binary-bitwise-or) operation.
2929

3030
For example, if you want to send a regular message and pay transfer fees separately, use the mode $0$ (default) and a flag $+1$ to get `mode` $= 1$, which is equal to using `SendPayGasSeparately{:tact}` constant.
3131

pages/book/operators.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ Both operators can be applied to the following list of types and values:
371371
* [`Cell{:tact}`][p], implicitly compares via `.hash(){:tact}`
372372
* [`Slice{:tact}`][p], implicitly compares via `.hash(){:tact}`
373373
* [`String{:tact}`][p]
374-
* [`map<k, v>{:tact}`](/book/maps), but only if their key and value types are identical
374+
* [`map<K, V>{:tact}`](/book/maps), but only if their key and value types are identical
375375
* [Optionals and `null{:tact}` value](/book/optionals)
376376

377377
```tact
@@ -399,7 +399,7 @@ emptyCell() != emptyCell(); // false
399399
"A" == "A"; // true
400400
"A" != "A"; // false
401401
402-
// map<k, v>:
402+
// map<K, V>:
403403
let map1: map<Int, Int> = emptyMap();
404404
let map2: map<Int, Int> = emptyMap();
405405
map1 == map2; // true

pages/book/optionals.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ As it was mentioned in [type system overview](/book/types#optionals), all [primi
66

77
[Variables](/book/statements#let) or fields of [Structs](/book/structs-and-messages#structs) and [Messages](/book/structs-and-messages#messages) that can hold `null{:tact}` are called "optionals". They're useful to reduce state size when the variable isn't necessarily used.
88

9-
You can make any variable or a field an optional by adding a question mark (`?{:tact}`) after its type declaration. The only exceptions are [`map<k, v>{:tact}`](/book/maps) and [`bounced<Msg>{:tact}`](/book/bounced#bounced-messages-in-tact), where you can't make them, inner key/value type (in case of a map) or the inner [Message](/book/structs-and-messages#messages) (in case of a bounced) optional.
9+
You can make any variable or a field an optional by adding a question mark (`?{:tact}`) after its type declaration. The only exceptions are [`map<K, V>{:tact}`](/book/maps) and [`bounced<Msg>{:tact}`](/book/bounced#bounced-messages-in-tact), where you can't make them, inner key/value type (in case of a map) or the inner [Message](/book/structs-and-messages#messages) (in case of a bounced) optional.
1010

1111
Optional variables or optional fields that are not defined hold the `null{:tact}` value by default. You cannot access them without checking for `null{:tact}` first. But if you're certain they are not `null{:tact}` at a given moment, use the [non-null assertion operator `!!{:tact}`](/book/operators#unary-non-null-assert) to access their value.
1212

pages/book/types.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ Note, while [contracts](#contracts) and [traits](#traits) are also considered a
5050

5151
### Maps
5252

53-
The type [`map<k, v>{:tact}`][maps] is used as a way to associate keys of type `k` with corresponding values of type `v`.
53+
The type [`map<K, V>{:tact}`][maps] is used as a way to associate keys of type `K{:tact}` with corresponding values of type `V{:tact}`.
5454

55-
Example of a [`map<k, v>{:tact}`][maps]:
55+
Example of a [`map<K, V>{:tact}`][maps]:
5656

5757
```tact
5858
let mapExample: map<Int, Int> = emptyMap(); // empty map with Int keys and values

pages/cookbook/data-structures.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Data structures are data organization, management, and storage formats that are
66

77
This page lists a handy collection of data structures implemented in Tact for your day-to-day needs and beyond.
88

9-
All of the data structures listed here are made using the built-in [`map<k, v>{:tact}`][map] type. For the description and basic usage of maps see the [dedicated page in the Book][map].
9+
All of the data structures listed here are made using the built-in [`map<K, V>{:tact}`][map] type. For the description and basic usage of maps see the [dedicated page in the Book][map].
1010

1111
## Array
1212

pages/ref/core-advanced.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ $+16$ | `ReserveBounceIfActionFail{:tact}` | Bounces the transaction if res
234234

235235
### Combining modes with flags [#nativereserve-combining-modes-with-flags]
236236

237-
To make the [`Int{:tact}`][int] value for `mode` parameter, you just have to combine base modes with optional flags by applying the [`bitwise OR{:tact}`](/book/operators#binary-bitwise-or) operation:
237+
To make the [`Int{:tact}`][int] value for `mode` parameter, you just have to combine base modes with optional flags by applying the [bitwise OR](/book/operators#binary-bitwise-or) operation:
238238

239239
```tact
240240
nativeReserve(ton("0.1"), ReserveExact | ReserveBounceIfActionFail);

pages/ref/core-base.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { Callout } from 'nextra-theme-docs'
44

5-
Every [contract](/book/contracts) and [trait](/book/types#traits) in Tact implicitly inherits the `Base{:tact}` trait, which contains a number of the most useful [internal functions](/book/contracts#internal-functions) for any kind of contract, and a constant `storageReserve` aimed at advanced users of Tact.
5+
Every [contract](/book/contracts) and [trait](/book/types#traits) in Tact implicitly inherits the `Base{:tact}` trait, which contains a number of the most useful [internal functions](/book/contracts#internal-functions) for any kind of contract, and a constant `self.storageReserve{:tact}` aimed at advanced users of Tact.
66

77
## Constants
88

@@ -16,7 +16,7 @@ Usage example:
1616

1717
```tact
1818
contract AllYourStorageBelongsToUs {
19-
// This would change the behaviour of self.reserve() function,
19+
// This would change the behaviour of self.forward() function,
2020
// causing it to try reserving this amount of nanoToncoins before
2121
// forwarding a message with SendRemainingBalance mode
2222
override const storageReserve = ton("0.1");
@@ -31,7 +31,7 @@ contract AllYourStorageBelongsToUs {
3131
virtual fun reply(body: Cell?);
3232
```
3333

34-
An alias to calling the [`forward(){:tact}`](#self-forward) function with the following arguments:
34+
An alias to calling the [`self.forward(){:tact}`](#self-forward) function with the following arguments:
3535

3636
```tact
3737
self.forward(sender(), body, true, null);
@@ -55,7 +55,7 @@ self.reply("Beware, this is my reply to you!".asComment());
5555
virtual fun notify(body: Cell?);
5656
```
5757

58-
An alias to calling the [`forward(){:tact}`](#self-forward) function with the following arguments:
58+
An alias to calling the [`self.forward(){:tact}`](#self-forward) function with the following arguments:
5959

6060
```tact
6161
self.forward(sender(), body, false, null);
@@ -81,7 +81,7 @@ virtual fun forward(to: Address, body: Cell?, bounce: Bool, init: StateInit?);
8181

8282
Sends a bounceable or non-bounceable message to the specified address `to`. Optionally, you may provide a `body` of the message and the [`init` package](/book/expressions#initof).
8383

84-
When [`storageReserve{:tact}`](#self-storagereserve) constant is overwritten to be $> 0$, before sending a message it also tries to reserve the `storageReserve{:tact}` amount of nanoToncoins from the remaining balance before making the send in the [`SendRemainingBalance{:tact}`](https://docs.tact-lang.org/book/message-mode#base-modes) ($128$) mode.
84+
When [`self.storageReserve{:tact}`](#self-storagereserve) constant is overwritten to be $> 0$, before sending a message it also tries to reserve the `self.storageReserve{:tact}` amount of nanoToncoins from the remaining balance before making the send in the [`SendRemainingBalance{:tact}`](https://docs.tact-lang.org/book/message-mode#base-modes) ($128$) mode.
8585

8686
In case reservation attempt fails and in the default case without the attempt, the message is sent with the [`SendRemainingValue{:tact}`](https://docs.tact-lang.org/book/message-mode#base-modes) ($64$) mode instead.
8787

pages/ref/standard-libraries.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import "@stdlib/deploy";
1515

1616
Library | Description | Commonly used APIs
1717
:----------------------- | :--------------------------------------------------------------- | :-----------------
18-
[`@stdlib/config`][1] | Config and elector address retrieval. | [`getConfigAddress{:tact}`][gca], [`getElectorAddress{:tact}`][gea]
19-
[`@stdlib/content`][2] | Encoding off-chain link [strings][p] to a [`Cell{:tact}`][p]. | [`createOffchainContent{:tact}`][coff]
18+
[`@stdlib/config`][1] | Config and elector address retrieval. | [`getConfigAddress(){:tact}`][gca], [`getElectorAddress(){:tact}`][gea]
19+
[`@stdlib/content`][2] | Encoding off-chain link [strings][p] to a [`Cell{:tact}`][p]. | [`createOffchainContent(){:tact}`][coff]
2020
[`@stdlib/deploy`][3] | Unified mechanism for deployments. | [`Deployable{:tact}`][dep], [`FactoryDeployable{:tact}`][fcd]
21-
[`@stdlib/dns`][4] | Resolution of [DNS][dns] names. | [`DNSResolver{:tact}`][dnsr], [`dnsInternalVerify{:tact}`][dnsi]
21+
[`@stdlib/dns`][4] | Resolution of [DNS][dns] names. | [`DNSResolver{:tact}`][dnsr], [`dnsInternalVerify(){:tact}`][dnsi]
2222
[`@stdlib/ownable`][5] | Traits for ownership management. | [`Ownable{:tact}`][own], [`OwnableTransferable{:tact}`][ownt]
2323
[`@stdlib/stoppable`][6] | Traits that allow contract stops. Requires [@stdlib/ownable][5]. | [`Stoppable{:tact}`][stp], [`Resumable{:tact}`][res]
2424

pages/ref/stdlib-ownable.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ message ChangeOwnerOk {
3434

3535
[Trait](/book/types#composite-types) `Ownable{:tact}` declares an owner (non-editable) of a [contract](/book/contracts) and provides a helper function `requireOwner(){:tact}` that checks that a message was sent by an owner.
3636

37-
This [trait](/book/types#composite-types) requires a field `owner: Address{:tact}` to be declared and exposes get-method `owner` to read it from the [contract](/book/contracts).
37+
This [trait](/book/types#composite-types) requires a field `owner: Address{:tact}` to be declared and exposes a [getter function](/book/functions#getter-functions) `owner(){:tact}`, which reads it from the [contract](/book/contracts).
3838

3939
Source code:
4040

@@ -88,7 +88,7 @@ trait OwnableTransferable with Ownable {
8888
self.owner = msg.newOwner;
8989
9090
// Reply result
91-
self.reply(ChangeOwnerOk{ queryId: msg.queryId, newOwner:msg.newOwner }.toCell());
91+
self.reply(ChangeOwnerOk{ queryId: msg.queryId, newOwner: msg.newOwner }.toCell());
9292
}
9393
}
9494
```

pages/ref/stdlib-stoppable.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import "@stdlib/stoppable"; // this would automatically import @stdlib/ownable t
1212

1313
### Stoppable
1414

15-
[Trait](/book/types#composite-types) `Stoppable{:tact}` implements receiver for the [Message](/book/structs-and-messages#messages) [string](/book/types#primitive-types) "Stop" that can be sent by owner, implements `stopped` get-method that returns `true{:tact}` if contract is stopped (or `false{:tact}` otherwise) and provides private (non-getter) functions `requireNotStopped(){:tact}` and `requireStopped(){:tact}`.
15+
[Trait](/book/types#composite-types) `Stoppable{:tact}` implements receiver for the [Message](/book/structs-and-messages#messages) [string](/book/types#primitive-types) "Stop" that can be sent by owner, implements `stopped(){:tact}` [getter function](/book/functions#getter-functions) that returns `true{:tact}` if contract is stopped (or `false{:tact}` otherwise) and provides private (non-getter) functions `requireNotStopped(){:tact}` and `requireStopped(){:tact}`.
1616

1717
Source code:
1818

0 commit comments

Comments
 (0)