@@ -2182,54 +2182,6 @@ the *failing* state, a task unwinds its stack, destroying all frames and
2182
2182
freeing all resources until it reaches its entry frame, at which point it
2183
2183
halts execution in the * dead* state.
2184
2184
2185
- ### Note expressions
2186
-
2187
- ~~~~~~~~ {.ebnf .gram}
2188
- note_expr : "note" expr ;
2189
- ~~~~~~~~
2190
-
2191
- ** Note: Note expressions are not yet supported by the compiler.**
2192
-
2193
- A ` note ` expression has no effect during normal execution. The purpose of a
2194
- ` note ` expression is to provide additional diagnostic information to the
2195
- logging subsystem during task failure. See [ log
2196
- expressions] ( #log-expressions ) . Using ` note ` expressions, normal diagnostic
2197
- logging can be kept relatively sparse, while still providing verbose
2198
- diagnostic "back-traces" when a task fails.
2199
-
2200
- When a task is failing, control frames * unwind* from the innermost frame to
2201
- the outermost, and from the innermost lexical block within an unwinding frame
2202
- to the outermost. When unwinding a lexical block, the runtime processes all
2203
- the ` note ` expressions in the block sequentially, from the first expression of
2204
- the block to the last. During processing, a ` note ` expression has equivalent
2205
- meaning to a ` log ` expression: it causes the runtime to append the argument of
2206
- the ` note ` to the internal logging diagnostic buffer.
2207
-
2208
- An example of a ` note ` expression:
2209
-
2210
- ~~~~ {.xfail-test}
2211
- fn read_file_lines(path: ~str) -> ~[~str] {
2212
- note path;
2213
- let r: [~str];
2214
- let f: file = open_read(path);
2215
- lines(f) |s| {
2216
- r += ~[s];
2217
- }
2218
- return r;
2219
- }
2220
- ~~~~
2221
-
2222
- In this example, if the task fails while attempting to open or read a file,
2223
- the runtime will log the path name that was being read. If the function
2224
- completes normally, the runtime will not log the path.
2225
-
2226
- A value that is marked by a ` note ` expression is * not* copied aside
2227
- when control passes through the ` note ` . In other words, if a ` note `
2228
- expression notes a particular ` lval ` , and code after the ` note `
2229
- mutates that slot, and then a subsequent failure occurs, the * mutated*
2230
- value will be logged during unwinding, * not* the original value that was
2231
- denoted by the ` lval ` at the moment control passed through the ` note `
2232
- expression.
2233
2185
2234
2186
### Return expressions
2235
2187
0 commit comments