Skip to content

Commit 0f64dea

Browse files
authored
chore(docs): show self or the extended type for referencing internal and extension functions, respectively (#3207)
1 parent 02a3b66 commit 0f64dea

File tree

13 files changed

+19
-19
lines changed

13 files changed

+19
-19
lines changed

docs/src/content/docs/book/cells.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ let areSlicesNotEqual = aSlice != bSlice; // false
433433

434434
Note that direct comparison via the `=={:tact}` or `!={:tact}` operators implicitly uses [SHA-256](https://en.wikipedia.org/wiki/SHA-2#Hash_standard) hashes of the [standard `Cell{:tact}` representation](#cells-representation) under the hood.
435435

436-
Explicit comparisons using `.hash(){:tact}` are also available:
436+
Explicit comparisons using the `hash(){:tact}` extension function that works on cells and slices are also available:
437437

438438
```tact
439439
let a = beginCell().storeUint(123, 8).endCell();

docs/src/content/docs/book/debug.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ it('emits', async () => {
716716
});
717717
```
718718

719-
To parse the second emitted message, we could manually use several `.loadSomething(){:typescript}` functions, but that's overly brittle — if the fields of the `Ballroom{:tact}` [struct][struct] ever change, you'd need to start all over. That could significantly backfire when you have numerous tests written in that manner.
719+
To parse the second emitted message, we could manually use various [`Slice{:tact}`][slice] extension functions, but that's overly brittle — if the fields of the `Ballroom{:tact}` [struct][struct] ever change, you'd need to start all over. That could significantly backfire when you have numerous tests written in that manner.
720720

721721
Fortunately, the Tact compiler auto-generates [TypeScript bindings (or wrappers)](/book/compile#wrap-ts) for contracts, making it easy to reuse them in your test suite. Not only do they provide wrappers for the contract you're testing, but they also export helper functions to store or load structs and [Messages][message] defined in the contract. These helper functions have names similar to their corresponding structures, prefixed with `load`.
722722

docs/src/content/docs/book/exit-codes.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ From the [Cells, Builders and Slices page](/book/cells#cells) of the Book:
288288
289289
To construct a [`Cell{:tact}`][cell], a [`Builder{:tact}`][builder] is used. If you try to store more than 1023 bits of data or more than 4 references to other cells, an error with exit code $8$ is thrown: `Cell overflow`.
290290

291-
This error can be triggered by [manual construction](/book/cells#cnp-manually) of the cells via [relevant `.storeSomething()` methods](/ref/core-cells#builder) or when [using structs and Messages and their convenience methods](/book/cells#cnp-structs).
291+
This error can be triggered by [manual construction](/book/cells#cnp-manually) of the cells via [relevant `Builder{:tact}` methods](/ref/core-cells#builder) or when [using structs and Messages and their convenience methods](/book/cells#cnp-structs).
292292

293293
```tact
294294
// Too many bits
@@ -326,7 +326,7 @@ From the [Cells, Builders and Slices page](/book/cells#cells) of the Book:
326326
327327
To parse a [`Cell{:tact}`][cell], a [`Slice{:tact}`][slice] is used. If you try to load more data or references than a `Slice{:tact}` contains, an error with exit code 9 is thrown: `Cell underflow`.
328328

329-
The most common cause of this error is a mismatch between the expected and actual memory layouts of the cells, so it's recommended to [use structs and Messages for parsing](/book/cells#cnp-structs) the cells instead of [manual parsing](/book/cells#cnp-manually) via [relevant `.loadSomething()` methods](/ref/core-cells#slice).
329+
The most common cause of this error is a mismatch between the expected and actual memory layouts of the cells, so it's recommended to [use structs and Messages for parsing](/book/cells#cnp-structs) the cells instead of [manual parsing](/book/cells#cnp-manually) via [relevant `Slice{:tact}` methods](/ref/core-cells#slice).
330330

331331
```tact
332332
// Too few bits

docs/src/content/docs/book/operators.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,8 @@ Both operators can be applied to the following list of types and values:
427427
* [`Int{:tact}`][int]
428428
* [`Bool{:tact}`][bool]
429429
* [`Address{:tact}`][p]
430-
* [`Cell{:tact}`][cell], implicitly compared via [`.hash(){:tact}`](/ref/core-cells#cellhash)
431-
* [`Slice{:tact}`][slice], implicitly compared via [`.hash(){:tact}`](/ref/core-cells#slicehash)
430+
* [`Cell{:tact}`][cell], implicitly compared via [`Cell.hash(){:tact}`](/ref/core-cells#cellhash)
431+
* [`Slice{:tact}`][slice], implicitly compared via [`Slice.hash(){:tact}`](/ref/core-cells#slicehash)
432432
* [`String{:tact}`][p]
433433
* [`map<K, V>{:tact}`](/book/maps), but only if their key and value types are identical
434434
* [Optionals and `null{:tact}` value](/book/optionals)
@@ -478,7 +478,7 @@ nullable != anotherNullable; // true
478478

479479
:::note
480480

481-
The binary equality `=={:tact}` and inequality `!={:tact}` operators implicitly compare [maps](/book/maps) by the hashes of their respective [cells][cell] via the [`.hash(){:tact}`](/ref/core-cells#cellhash) function. While this is acceptable in the majority of cases—since most map serializers behave identically to the serializer from TON Blockchain sources—it is still possible to obtain false-negative results if a map is serialized manually or if the serialization logic is modified in certain libraries.
481+
The binary equality `=={:tact}` and inequality `!={:tact}` operators implicitly compare [maps](/book/maps) by the hashes of their respective [cells][cell] via the [`hash(){:tact}`](/ref/core-cells#cellhash) extension function. While this is acceptable in the majority of cases—since most map serializers behave identically to the serializer from TON Blockchain sources—it is still possible to obtain false-negative results if a map is serialized manually or if the serialization logic is modified in certain libraries.
482482

483483
If you need to guarantee that compared maps are equal and are willing to pay significantly more gas, use the [`map.deepEquals(){:tact}`](/book/maps#deepequals) function.
484484

docs/src/content/docs/book/send.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ self.reply("Hello, World!".asComment()); // asComment converts a String to a Cel
3333

3434
If you need more advanced logic, you can use the `send(){:tact}` function and the `SendParameters{:tact}` [struct][struct] directly.
3535

36-
In fact, the previous example with [`.reply(){:tact}`](#send-simple-reply) can be made using the following call to the `send(){:tact}` function:
36+
In fact, the previous example with [`self.reply(){:tact}`](#send-simple-reply) can be made using the following call to the `send(){:tact}` function:
3737

3838
```tact
3939
send(SendParameters {

docs/src/content/docs/book/statements.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ do {
500500

501501
The `foreach{:tact}` loop operates on key-value pairs (entries) of the [`map<K, V>{:tact}`](/book/maps) type in sequential order: from the smallest keys of the map to the biggest ones.
502502

503-
This loop executes a block of code for each entry in the given map, capturing the key and value on each iteration. This is handy when you don't know in advance how many items there are in the map or don't want to explicitly look for each of the entries using the [`.get(){:tact}`](/book/maps#get) [method](/book/functions#extensions) of maps.
503+
This loop executes a block of code for each entry in the given map, capturing the key and value on each iteration. This is handy when you don't know in advance how many items there are in the map or don't want to explicitly look for each of the entries using the [`get(){:tact}`](/book/maps#get) [method](/book/functions#extensions) of maps.
504504

505505
Note that the names of captured keys and values in each iteration are arbitrary and can be any valid Tact identifier, provided they are new to the current scope. The most common options are: `k` and `v`, or `key` and `value`.
506506

docs/src/content/docs/book/structs-and-messages.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ fun conversionFun() {
276276

277277
### Obtain from a `Cell` or `Slice`, `.fromCell()` and `.fromSlice()` {#fromcellslice}
278278

279-
Instead of manually parsing a [`Cell{:tact}`][cell] or [`Slice{:tact}`][slice] via a series of relevant `.loadSomething(){:tact}` function calls, one can use `.fromCell(){:tact}` and `.fromSlice(){:tact}` [extension functions](/book/functions#extensions) to convert the provided [`Cell{:tact}`][cell] or [`Slice{:tact}`][slice] into the needed [struct](#structs) or [Message](#messages).
279+
Instead of manually parsing a [`Cell{:tact}`][cell] or [`Slice{:tact}`][slice] via a series of relevant `Slice{:tact}` extension function calls, one can use `.fromCell(){:tact}` and `.fromSlice(){:tact}` [extension functions](/book/functions#extensions) to convert the provided `Cell{:tact}` or `Slice{:tact}` into the needed [struct](#structs) or [Message](#messages).
280280

281281
These extension functions only attempt to parse a [`Cell{:tact}`][cell] or [`Slice{:tact}`][slice] according to the structure of your struct or Message. In case the layouts don't match, various exceptions may be thrown — make sure to wrap your code in [`try...catch{:tact}`](/book/statements#try-catch) blocks to prevent unexpected results.
282282

docs/src/content/docs/cookbook/single-communication.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ contract Example {
8787
}
8888
```
8989

90-
The latter example is identical to using the [`.reply(){:tact}` function](#how-to-make-a-basic-reply).
90+
The latter example is identical to using the [`self.reply(){:tact}` function](#how-to-make-a-basic-reply).
9191

9292
## How to send a message with a long text comment
9393

docs/src/content/docs/zh-cn/book/cells.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ let areSlicesNotEqual = aSlice != bSlice; // false
408408

409409
请注意,通过 `=={:tact}``!={:tact}` 操作符进行的直接比较隐含地使用了[标准 `Cell{:tact}` 表示法](#cells-representation)[SHA-256](https://en.wikipedia.org/wiki/SHA-2#Hash_standard) 哈希值。
410410

411-
还可使用 `.hash(){:tact}` 进行显式比较:
411+
还可使用 `Cell.hash(){:tact}``Slice.hash(){:tact}` 进行显式比较:
412412

413413
```tact
414414
let a = beginCell().storeUint(123, 8).endCell();

docs/src/content/docs/zh-cn/book/exit-codes.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ contract VibeCheck {
285285
286286
要构建一个 [`cellent{:tact}`][cell], 使用 [`Builder{:tact}`][builder] 如果尝试存储的数据超过 $1023$ 位,或对其他cell的引用超过 $4$ ,则会出现退出码为 $8$ 的错误:"`Cell overflow`
287287

288-
这个错误可以由[手动construction](/zh-cn/book/cells#cnp-manual y) 通过[relevant `.loadSomething()`方法](/zh-cn/ref/core-cells)[使用结构和消息及其方便方法](/zh-cn/book/cells#cnp-structs) 触发。
288+
这个错误可以由[手动construction](/zh-cn/book/cells#cnp-manual y) 通过[relevant `Builder.storeSomething(){:tact}`方法](/zh-cn/ref/core-cells)[使用结构和消息及其方便方法](/zh-cn/book/cells#cnp-structs) 触发。
289289

290290
```tact
291291
// Too much bits
@@ -323,7 +323,7 @@ try {
323323
324324
若要解析[`cell{:tact}`][cell],请使用 [`slice{:tact}`][slice] 如果你试图加载比`slice{:tact}`更多的数据或引用,则退出码 $9$ 的错误就会抛出:“cell下溢”。
325325

326-
此错误的最常见原因是cell的预期内存布局和实际内存布局不匹配, 因此建议[使用结构和消息进行解析](/zh-cn/book/cells#cnp-structs) ,而不是[手动解析](/zh-cn/book/cells#cnp-manually) 通过 [relevant `. oadSomething()` 方法](/zh-cn/ref/core-cells)
326+
此错误的最常见原因是cell的预期内存布局和实际内存布局不匹配, 因此建议[使用结构和消息进行解析](/zh-cn/book/cells#cnp-structs) ,而不是[手动解析](/zh-cn/book/cells#cnp-manually) 通过 [relevant `Slice.loadSomething(){:tact}`方法](/zh-cn/ref/core-cells)
327327

328328
```tact
329329
// Too few bits

0 commit comments

Comments
 (0)