I was thinking about an alternative design that works similar to the continuations usage but that (I think) is more intuitive from a software developer's point while keeping the same ideas.
(...)
A list of WVM instructions will look like:
0 "READ formLogin FROM USER" 1 "SERVLET_CheckFormLogin" ... 10 "READ formUserSelection FROM USER" 11 "READ formContact FROM USER" 12 "READ formPaymentInfo FROM USER" 13 "SERVLET_RegisterBuyInDataBase" 14 "READ formUserExit FROM USER" 15 "IF formUserExit NOT TRUE" 16 "GOTO 10" 17 "GOTO 0"
The programmer will just need to work on the
formData's and the custom-made "SERVLET_..."
basically we back to procedural programming. :)
the guys behind nevow[1] are writing a module called wolf that allows this type of approach to web programming.
here there's a code snippet from an early wolf example[2], the classic "guess what number is":
def index(self, req):
yield self._get_username(req) name = req.args.get("username", [""])[0]
guesses = 0
number = random.randint(0, 10)
hint = "No hint for you!"while True:
guesses = guesses + 1
yield self._get_guess(req, name, hint)
guess = int(req.args.get("guess", [""])[0])
if guess > number:
hint = "Lower"
elif guess < number:
hint = "Higher"
elif guess == number:
break
else:
hint = "Some weirdo error happened."
yield "<html><body><b>%s won in %d guesses.</b></body></html>" % (name, guesses)
as you can see you yield _pages_ and write the whole process in linear fashion, pretty cool, if you ask me.
actually nevow's wolf component is under heavy refactoring and still pretty crude, but it's a step on the right direction, i think.
bye.
[1] <http://www.nevow.org> [2] <http://www.divmod.org/svn/Nevow/sandbox/phunt/wolf/wolf/example.py>
------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ Webware-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/webware-discuss
