From c3f3fd2b25ebc301b11982fda4354b0ead0b2470 Mon Sep 17 00:00:00 2001 From: jim Date: Fri, 1 May 2015 07:24:53 -0400 Subject: [PATCH] comment about abortable traversals --- topics/week13_coroutines_exceptions_and_aborts.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/topics/week13_coroutines_exceptions_and_aborts.mdwn b/topics/week13_coroutines_exceptions_and_aborts.mdwn index a820bde6..f1d59254 100644 --- a/topics/week13_coroutines_exceptions_and_aborts.mdwn +++ b/topics/week13_coroutines_exceptions_and_aborts.mdwn @@ -374,7 +374,7 @@ You can think of them as functions that represent "how the rest of the computati The key idea behind working with continuations is that we're *inverting control*. In the fragment above, the code `(if x = 1 then ... else outer_snapshot 20) + 100`---which is written as if it were to supply a value to the outside context that we snapshotted---itself *makes non-trivial use of* that snapshot. So it has to be able to refer to that snapshot; the snapshot has to somehow be available to our inside-the-box code as an *argument* or bound variable. That is: the code that is *written* like it's supplying an argument to the outside context is instead *getting that context as its own argument*. He who is written as value-supplying slave is instead become the outer context's master. -In fact you've already seen this several times this semester---recall how in our implementation of pairs in the untyped lambda-calculus, the handler who wanted to use the pair's components had *in the first place to be supplied to the pair as an argument*. So the exotica from the end of the seminar was already on the scene in some of our earliest steps. Recall also what we did with our [[abortable list traversals|/topics/week12_abortable_traversals]]. +In fact you've already seen this several times this semester---recall how in our implementation of pairs in the untyped lambda-calculus, the handler who wanted to use the pair's components had *in the first place to be supplied to the pair as an argument*. So the exotica from the end of the seminar was already on the scene in some of our earliest steps. Recall also what we did with our [[abortable list traversals|/topics/week12_abortable_traversals]]. (The `outer_snapshot` corresponds to the "done" handler in those traversals; and the `continue_foo_snapshot` to the "keep_going" handler.) This inversion of control should also remind you of Montague's treatment of determiner phrases in ["The Proper Treatment of Quantification in Ordinary English"](http://www.blackwellpublishing.com/content/BPL_Images/Content_store/Sample_chapter/0631215417%5CPortner.pdf) (PTQ). -- 2.11.0