new items, 8
end
def render_content_on(r)
r.list_do @batcher.batch do |item|
r.anchor item.title do choose item end
end
r.render @batcher
end
end # class SushiNet::StoreItemList
The bulk of the action happens in the render_content_on method, which uses a
BatchedList (a paginator) to render a paginated list of links to products. But the fun
happens in the call to anchor, which stores away the call to choose, to be executed
when the corresponding link is clicked.
However, there is still vast disagreement on how useful continuations are for web
programming. HTTPwas designed as a stateless protocol, and continuations for
web transactions are the polar opposite of statelessness. All of the continuations
must be stored on the server, which takes additional memory and disk space. Sticky
sessions are required, to direct a user??™s traffic to the same server. As a result, if one
server goes down, all of its sessions are lost. The most popular Seaside application,
DabbleDB (http://dabbledb.com/), actually uses continuations very little.
Bindings
Bindings provide context for evaluation of Ruby code. A binding is the set of variables
and methods that are available at a particular (lexical) point in the code. Any
place in Ruby code where statements may be evaluated has a binding, and that binding
can be obtained with Kernel#binding. Bindings are just objects of class Binding,
and they can be passed around as any objects can:
class C
binding # => #
def a_method
binding
end
end
binding # => #
C.
Pages:
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57