Skip to content

Commit

Permalink
Fix minor typos in text and code examples (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
yjshi2015 authored Jun 24, 2024
1 parent d1ece86 commit 84b29e1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
7 changes: 6 additions & 1 deletion book/src/move-basics/ownership-and-scope.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@ module book::ownership {
let a = 1; // a is owned by the `owner` function
} // a is dropped here
public fun other() {
let b = 2; // b is owned by the `other` function
} // b is dropped here
#[test]
fun test_owner() {
owner();
// a is not valid here
other();
// a & b is not valid here
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion book/src/programmability/module-initializer.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The function is called on publish, if it is present in the module and follows th

- The function has to be named `init`, be private and have no return values.
- Takes one or two arguments: [One Time Witness](./one-time-witness.md) (optional) and
[TxContext](./transaction-context.md). With `TxContext always being the last argument.
[TxContext](./transaction-context.md). With `TxContext` always being the last argument.

```move
fun init(ctx: &mut TxContext) { /* ... */}
Expand Down
2 changes: 1 addition & 1 deletion book/src/programmability/publisher.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ system configurations, it can also be used to manage the application's state.
```

However, Publisher misses some native properties of [Capabilities](./capability.md), such as type
safety and expressiveness. The signature for the `admin_function` is not very explicit, can be
safety and expressiveness. The signature for the `admin_action` is not very explicit, can be
called by anyone else. And due to `Publisher` object being standard, there now is a risk of
unauthorized access if the `from_module` check is not performed. So it's important to be cautious
when using the `Publisher` object as an admin role.
Expand Down
2 changes: 1 addition & 1 deletion book/src/programmability/witness-pattern.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module book::witness_source {
}
```

The instance of the struct `W` is passed into the `new` function to create an `Instance<W>`, thereby
The instance of the struct `W` is passed into the `new_instance` function to create an `Instance<W>`, thereby
proving that the module `book::witness_source` owns the type `W`.

## Instantiating a Generic Type
Expand Down
2 changes: 1 addition & 1 deletion packages/samples/sources/programmability/bcs.move
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use sui::bcs;
let bool_bytes = bcs::to_bytes(&true);
// 0x2a - just a single byte
let u8_bytes = bcs::to_bytes(&42u8);
// 0x000000000000002a - 8 bytes
// 0x2a00000000000000 - 8 bytes
let u64_bytes = bcs::to_bytes(&42u64);
// address is a fixed sequence of 32 bytes
// 0x0000000000000000000000000000000000000000000000000000000000000002
Expand Down
4 changes: 2 additions & 2 deletions reference/src/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ x = 1;

### Multiple declarations with structs

`let` can also introduce more than one local at a time when destructuring (or matching against) a
`let` can also introduce more than one local variables at a time when destructuring (or matching against) a
struct. In this form, the `let` creates a set of local variables that are initialized to the values
of the fields from a struct. The syntax looks like this:

Expand All @@ -226,7 +226,7 @@ public struct P(u64, u64)
and

```move
let P(local1, local2) = T { f1: 1, f2: 2 };
let P (local1, local2) = P ( 1, 2 );
// local1: u64
// local2: u64
```
Expand Down

0 comments on commit 84b29e1

Please sign in to comment.