diff options
| author | Corey Richardson <corey@octayn.net> | 2013-12-10 09:26:11 -0500 |
|---|---|---|
| committer | Corey Richardson <corey@octayn.net> | 2013-12-10 09:43:36 -0500 |
| commit | fab5624eb6373d529f21309380ea467a8b4b5664 (patch) | |
| tree | 087d7ab26484d79af6efb70f805dae4118357b66 /doc/tutorial.md | |
| parent | a44852a2d5ac12545a3c1b55dab1c3d4070872a1 (diff) | |
| download | rust-fab5624eb6373d529f21309380ea467a8b4b5664.tar.gz rust-fab5624eb6373d529f21309380ea467a8b4b5664.zip | |
Tiny fixes to linked list section.
Diffstat (limited to 'doc/tutorial.md')
| -rw-r--r-- | doc/tutorial.md | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/doc/tutorial.md b/doc/tutorial.md index f6895adff06..74a02a12023 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -1235,8 +1235,9 @@ xs = prepend::<int>(xs, 15); xs = prepend::<int>(xs, 20); ~~~ -In the type grammar, the language uses `Type<T, U, V>` to describe a list of -type parameters, but expressions use `identifier::<T, U, V>`. +In declarations, the language uses `Type<T, U, V>` to describe a list of type +parameters, but expressions use `identifier::<T, U, V>`, to disambiguate the +`<` operator. ## Defining list equality with generics @@ -1313,7 +1314,7 @@ provide. In uncommon cases, the indirection can provide a performance gain or memory reduction by making values smaller. However, unboxed values should almost -always be preferred. +always be preferred when they are usable. Note that returning large unboxed values via boxes is unnecessary. A large value is returned via a hidden output parameter, and the decision on where to @@ -1324,7 +1325,7 @@ fn foo() -> (u64, u64, u64, u64, u64, u64) { (5, 5, 5, 5, 5, 5) } -let x = ~foo(); // allocates, and writes the integers directly to it +let x = ~foo(); // allocates a ~ box, and writes the integers directly to it ~~~~ Beyond the properties granted by the size, an owned box behaves as a regular @@ -1403,7 +1404,7 @@ compute_distance(managed_box, owned_box); Here the `&` operator is used to take the address of the variable `on_the_stack`; this is because `on_the_stack` has the type `Point` (that is, a struct value) and we have to take its address to get a -value. We also call this _borrowing_ the local variable +reference. We also call this _borrowing_ the local variable `on_the_stack`, because we are creating an alias: that is, another route to the same data. |
