You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,8 +85,8 @@ Note that BorrowChecker.jl does not prevent you from cheating the system and usi
85
85
### Basics
86
86
87
87
-`@own [:mut] x = value`: Create a new owned value (mutable if `:mut` is specified)
88
-
- These are `Owned{T}` and `OwnedMut{T}` objects, respectively.
89
-
- You can use `@own [:mut] x` as a shorthand for `@own [:mut] x = x` to create owned values at the start of a function.
88
+
- These are `Owned{T}` and `OwnedMut{T}` objects, respectively.
89
+
- You can use `@own [:mut] x` as a shorthand for `@own [:mut] x = x` to create owned values at the start of a function.
90
90
-`@move [:mut] new = old`: Transfer ownership from one variable to another (mutable destination if `:mut` is specified). _Note that this is simply a more explicit version of `@own` for moving values._
91
91
-`@clone [:mut] new = old`: Create a deep copy of a value without moving the source (mutable destination if `:mut` is specified).
92
92
-`@take[!] var`: Unwrap an owned value. Using `@take!` will mark the original as moved, while `@take`will perform a copy.
@@ -96,12 +96,12 @@ Note that BorrowChecker.jl does not prevent you from cheating the system and usi
96
96
97
97
-`@lifetime lt begin ... end`: Create a scope for references whose lifetimes `lt` are the duration of the block
98
98
-`@ref ~lt [:mut] var = value`: Create a reference, for the duration of `lt`, to owned value `value` and assign it to `var` (mutable if `:mut` is specified)
99
-
- These are `Borrowed{T}` and `BorrowedMut{T}` objects, respectively. Use these in the signature of any function you wish to make compatible with references. In the signature you can use `OrBorrowed{T}` and `OrBorrowedMut{T}` to also allow regular `T`.
99
+
- These are `Borrowed{T}` and `BorrowedMut{T}` objects, respectively. Use these in the signature of any function you wish to make compatible with references. In the signature you can use `OrBorrowed{T}` and `OrBorrowedMut{T}` to also allow regular `T`.
100
100
101
101
### Automatic Ownership Transfer
102
102
103
103
-`BorrowChecker.Experimental.@managed begin ... end`: create a scope where contextual dispatch is performed using [Cassette.jl](https://github.com/JuliaLabs/Cassette.jl): recursively, all functions (_**in all dependencies**_) are automatically modified to apply `@take!` to any `Owned{T}` or `OwnedMut{T}` input arguments.
104
-
- Note: this is an experimental feature that may change or be removed in future versions. It relies on compiler internals and seems to break on certain functions (like SIMD operations).
104
+
- Note: this is an experimental feature that may change or be removed in future versions. It relies on compiler internals and seems to break on certain functions (like SIMD operations).
105
105
106
106
### Assignment
107
107
@@ -194,7 +194,7 @@ ERROR: Variable `y` holds an object that was reassigned from `x`.
194
194
195
195
This won't catch all misuses but it can help prevent some.
196
196
197
-
### References and Lifetimes
197
+
### Lifetimes
198
198
199
199
References let you temporarily _borrow_ values. This is useful for passing values to functions without moving them. These are created within an explicit `@lifetime` block:
0 commit comments