8. However, they are useful constructs,
26 | Chapter 1: Foundational Techniques
and continuation-based web frameworks provide an interesting alternative to frameworks
like Rails, so we will survey their use here.
Continuations are powerful for several reasons:
??? Continuations are just objects; they can be passed around from function to
function.
??? Continuations can be invoked from anywhere. If you hold a reference to a continuation,
you can invoke it.
??? Continuations are re-entrant. You can use continuations to return from a function
multiple times.
Continuations are often described as ???structured GOTO.??? As such, they should be
treated with the same caution as any kind of GOTO construct. Continuations have little
or no place inside application code; they should usually be encapsulated within
libraries. I don??™t say this because I think developers should be protected from themselves.
Rather, continuations are general enough that it makes more sense to build
abstractions around them than to use them directly. The idea is that a programmer
should think ???external iterator??? or ???coroutine??? (both abstractions built on top of
continuations) rather than ???continuation??? when building the application software.
Seaside* is a Smalltalk web application framework built on top of continuations.
Continuations are used in Seaside to manage session state.
Pages:
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55