Chad Fowler wrote:
> How are you calling it from IRB? It didn't work for me, and before I
> spent too much time trying to figure out why, I thought I'd ask this
> first.
Thanks for your reply. I have to admit that 'calling from irb' is not a
very detailed description.

I meant something like this:
irb(main):001:0> require 'conttest.rb'
=> true
irb(main):002:0> cs=ContServer.init
=> #<ContServer:0x2812560 @conts={},
@mains={}, @blocks={"guess"=>#<Proc:0x02812548@./conttest.rb:34>}>
irb(main):003:0> cs.service(1,'guess',50) # (last arg ignored)
=> "Please enter a number between 1 and 100."
irb(main):004:0> cs.service(1,'guess',50) # (middle arg ignored)
=> "Lower"
irb(main):005:0> cs.service(1,'guess',25) # (middle arg ignored)
=> "You found it in 2 rounds."
irb(main):006:0> cs.service(1,'guess',25) # (last arg ignored)
=> "Please enter a number between 1 and 100."
irb(main):007:0> cs.service(1,'guess',50) # (middle arg ignored)
=> "Higher"
....and so on. This also seems to work with multiple 'services' and
multiple 'users' (i.e. IDs) with interleaved access.
Please try to ignore the crappy arg handling (and also the off-by-one
error for the random expectation). I'm just trying to figure out how a
continuation-based web server is supposed to work. For me this was the
'simplest thing that could possibly emulate this'. Perhaps I am totally
off the track, but if so, I'd really like to know why.
Regards,
Patrick