From f4bf1626e10b545521754d0315f6116781f436bb Mon Sep 17 00:00:00 2001 From: Sean Chen Date: Tue, 23 Aug 2022 14:55:57 -0500 Subject: [PATCH] Miscellaneous book revisions --- book/src/tutorial/accumulators.md | 4 ++-- book/src/tutorial/parser.md | 2 +- book/src/videos.md | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/book/src/tutorial/accumulators.md b/book/src/tutorial/accumulators.md index 7352ab6c..7e627487 100644 --- a/book/src/tutorial/accumulators.md +++ b/book/src/tutorial/accumulators.md @@ -1,12 +1,12 @@ # Defining the parser: reporting errors The last interesting case in the parser is how to handle a parse error. -Because salsa functions are memoized and may not execute, they should not have side-effects, +Because Salsa functions are memoized and may not execute, they should not have side-effects, so we don't just want to call `eprintln!`. If we did so, the error would only be reported the first time the function was called, but not on subsequent calls in the situation where the simply returns its memoized value. -salsa defines a mechanism for managing this called an **accumulator**. +Salsa defines a mechanism for managing this called an **accumulator**. In our case, we define an accumulator struct called `Diagnostics` in the `ir` module: ```rust diff --git a/book/src/tutorial/parser.md b/book/src/tutorial/parser.md index 1540364a..03b7d737 100644 --- a/book/src/tutorial/parser.md +++ b/book/src/tutorial/parser.md @@ -63,7 +63,7 @@ It's generally better to structure tracked functions as functions of a single Sa ### The `return_ref` annotation -You may have noticed that `parse_statements` is tagged with `#[salsa::tracked(return_ref)]`. [The function isn't actually tagged with `return_ref`; is the text incorrect or the code example?] +You may have noticed that `parse_statements` is tagged with `#[salsa::tracked(return_ref)]`. Ordinarily, when you call a tracked function, the result you get back is cloned out of the database. The `return_ref` attribute means that a reference into the database is returned instead. So, when called, `parse_statements` will return an `&Vec` rather than cloning the `Vec`. diff --git a/book/src/videos.md b/book/src/videos.md index 9e6bd009..0fa15248 100644 --- a/book/src/videos.md +++ b/book/src/videos.md @@ -1,12 +1,12 @@ # Videos -There are currently two videos about salsa available, but they describe an older version of salsa and so they are rather outdated: +There are currently two videos about Salsa available, but they describe an older version of Salsa and so they are rather outdated: - [How Salsa Works](https://youtu.be/_muY4HjSqVw), which gives a high-level introduction to the key concepts involved and shows how - to use salsa; + to use Salsa; - [Salsa In More Depth](https://www.youtube.com/watch?v=i_IhACacPRY), which digs into the incremental algorithm and explains -- at a - high-level -- how salsa is implemented. + high-level -- how Salsa is implemented. > If you're in China, watch videos on [How Salsa Works](https://www.bilibili.com/video/BV1Df4y1A7t3/), [Salsa In More Depth](https://www.bilibili.com/video/BV1AM4y1G7E4/).