Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • ...continuation-based web frameworks

    Continuations are one of the things (among others, I'm told) that Ruby borrowed from Lisp. At least one framework, Borges [rubyforge.org], uses continuations as a way to deal with state.

    Unfortunately, I'm not one of those people smart enough to figure out how I can use continations to my advantage in daily work.

    • by brev (1827) on 2004.07.05 13:57 (#32148)

      Almost every web app spends most of its time just recreating a state that it understands. And the logic of transitions between pages have to be unrolled into a big switch statement up front.

      If perl 7 had continuations, you could do this:

      #!/usr/bin/perl7

      # website that sells t-shirts

      $user = CGI::Continuation.new();

      show_start_page();

      if ($user.t_shirts) {
         show_shirts();  # each shirt has a buy button
         if ($user.show_close_up) {
             show_close_up($user.shirt_id);  # also shows buy button
         }
         if ($user.buy) {
             show_sizes();
             show_legal_stuff();
             show_credit_card_form();
             if ($user.credit_card.buy($user.shirt_id)) {
                show_thanks();
             } else {
                show_transaction_not_approved();
             }
         }
      }

      Continuation frameworks aren't a panacea--they run into trouble when dealing with world outside their interaction model. But you can see why they excite some people.

      N.B. it's not just about multi-page forms either. Check out Borges or Seaside for the details.