Skip to content

Commit f70ac4a

Browse files
committed
Add comments to safe mode doc page
1 parent fb33693 commit f70ac4a

File tree

1 file changed

+3
-2
lines changed
  • docs/_docs/reference/experimental/capture-checking

1 file changed

+3
-2
lines changed

docs/_docs/reference/experimental/capture-checking/safe.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import scala.collection.mutable.HashMap
4646
@assumeSafe
4747
class Memoized[A, B](f: A -> B) {
4848

49-
@untrackedCaptures
49+
@untrackedCaptures // allowed since we are not in safe mode
5050
private val cached = HashMap[A, B]()
5151

5252
def apply(x: A) = cached.getOrElseUpdate(x, f(x))
@@ -63,7 +63,8 @@ object CheckedMailer {
6363

6464
def sendMail(email: Email) =
6565
if userPrompt(s"OK to send email?\n\n$email") then
66-
Mailer.send(email)
66+
Mailer.send(email) // allowed even if Mailer is not @assumeSafe
67+
// since we are not in safe mode
6768
}
6869
```
6970
There's also the `@rejectSafe` annotation in `caps`, which can be seen to be a dual to `@assumeSafe`. It renders selected members of assumed safe components inaccessible in safe mode.

0 commit comments

Comments
 (0)