Arc Forumnew | comments | leaders | submit | larry_h's commentslogin
1 point by larry_h 6090 days ago | link | parent | on: Poll: Where are you from ?

Sweden

-----


When in ruby using Pannonica (a component based framework):

  class ArcChallenge < Pan::Task                                                               
    def go                                                                                     
      msg = call Input.new                                                                     
      call ClickHere.new                                                                       
      call YouSaid.new(msg)                                                                    
    end                                                                                        
  end

  class Input < Pan::Component                                                                 
    def render_on(html)                                                                        
      html.form {                                                                              
        html.input                                                                             
        html.submit {|val| answer(val)}                                                        
      }                                                                                        
    end                                                                                        
  end

  class ClickHere < Pan::Component                                                             
    def render_on(html)                                                                        
      html.link("Click here") { answer }                                                       
    end                                                                                        
  end

  class YouSaid < Pan::Component                                                               
    def initialize(msg)                                                                        
      @msg = msg                                                                               
    end                                                                                        
    def render_on(html)                                                                        
      html.lit("you said: #{@msg}")                                                            
    end                                                                                        
  end
It is worth noting the use of the seaside-like continuation based task construct.

Though not as tight as mr. Grahams code it does not lack in clarity IMHO.

-----