Plaster

text
From: Ken Tilton <kent...@gmail.com> Newsgroups: comp.lang.lisp Subject: Re: Need more info... References: <Tj2bg.24$%Y5.0@fe11.lga> <1148077542.590658.275630@i40g2000cwc.googlegroups.com> In-Reply-To: <1148077542.590658.275630@i40g2000cwc.googlegroups.com> Message-ID: <5subg.1253$023.945@fe08.lga> Date: Fri, 19 May 2006 21:40:18 -0400 Jonathon McKitrick wrote: > Ken Tilton wrote: > >>Howard Yeh: Wispy Lisp := A Lispy Web-framework >> (trying to go RoR and even LoL one better) > > > Where is the info on this one? > Looks like it is a shoe-in for approval: # Misread 7500 as 7500 word limit... sorry. Wispy Lisp := A Lispy Web-framework by Howard Yeh hay...@gmail.com ---Synopsis--- A unified syntax for web-programming. ---Proposal--- This web-framework would provide all the necessary tools to create a respectable, fully dynamic web-application. A programmer would code in a unified meta-syntax that subsumes html, css, javascript, sql, and lisp-- effectively blurring client/server scripting. HTML/CSS generation should paper over the (perverse) idiosyncrasies of certain web-browsers, and conform to web standards. The most infamous being, naturally, the box-model interpretation. In this case, the framework's generator should transparently attach the necessary fix (i.e. box-model hack). User can override this behavior. Parenscript covers primitive interface scripting. A lisp syntax to Google's AJAXSLT would allow higher abstraction to interface programming. This project would also include a mini data-persistence language by extending CLSQL. This mini-language would provide declarative specification of table definitions, relations, and constraint s. Instead of raw SQL for data retrieving/storing, a simple pattern matching syntax is used. In a typical application under this framework, the programmer would first specify the app's valid dataset with a declarative schema. This data schema determines the legal pattern matching syntax the programmer can use to access/persist data. The interface templating system helps the programmer to establish robust communication channels between client and server. By declaring 'SETFable' places in various subtemplates, local/remote functions have well defined places to return their response. ---Syntax--- ............ Data Schema: ............ ;; Defines database ;; ;; In later iterations, perhaps redefines database safely. (def-schemas <schema>) <schema> := (<table-name> <field>*) <field> := <simple-field> | <complex-field> <simple-field> := (<symbol> <data-type>) <complex-field> := (<relation> <table-name>) <data-type> := integer | (string <number>) | date <relation> := :many | :one ;; Example: (def-schemas (brain (blood-pressure integer) (color (string 32)) (smell (string 32)) (:many personality) (:one obsession) (:many dream)) (personality (complex (string 32)) (mood integer) (:many brain)) (obsession (nature (string 255)) (shrink (string 32)) (hourly-rate integer)) (dream (expiry-date date) (price integer)))) The 'id' fields of each schemas are implied. The ':many' relation generates an auxiliary table, and foreign keys in the related tables. Similarly, the ':one' relation. ............... Data Retrieval: ............... Now that we have a few brains in our database, we can fetch them. ;; Data query mini-language ;; ;; Data persisting is similar (with-data <variable> <query> &key limit offset) <query> := (<query-function>? <table-name> <field>*) <table-name> := (<symbol> <symbol>) | <symbol> <field> := <field-name> | (<field-name> <test-cond>) | <query> <test-cond> := (<test-op> <var> <var>*) <test-op> := < | <= | = | >= | > | or | and <query-function> := :sum | :max | :min ;;Example (let-data ((b brain) (color (= color 'jaundice')) (smell (or (= smell 'rotten') (= smell 'sour'))) ((p personality) complex mood ((b2 brain) smell (blood-pressure (> 150)) ((p2 personality) mood)))) (out (h1: 'Down the meat grinder:') (:div (b-smell ' stuff and ' b-color)) (:div ('Perfectly suited for ' b2-mood ' clients with blood-pressure exceeding (or at): ' (:em br-blood-pressure)))) :limit 100) 'let-data' binds the fields of the a matching record to corresponding symbols (possibly prefixed with table alias). The second argument provides an action to iterate over all the matching records. The matching conditions are collected and combined into the SQL 'where' statement. The join conditions are generated appropriately as defined by the schema. ........... Templating: ........... (def-wact ...) ;; Server action (def-jact ...) ;; Client action <template> := (<tag> <attribute-pair>* <template>*) | <datum> | <s-exp> <tag> := <keyword> | <wisp-tag> | <user-tag> <attribute-pair> := <keyword> <s-exp> <wisp-tag> := <mk-form> | <mk-target> | <mk-act> <mk-form> := (mk-form (<symbol>*) <template> &key action) <mk-target> := (mk-target <symbol> (<target-place>*) <template>) <mk-act> := (mk-act (s-exp) &key caption) <target-place> := <symbol> | (<symbol> <s-exp>) ;; EXAMPLE (def-wact enlargement (name age e-mail :key (referral 'gink maps')) (out (:html (:body (:h 'YOUR GIRL DISAPPOINTED WITH YOUR SIZE???!!!!') (:b :color 'blood-red 'LOOK NO FURTHER!! 100% PRIVACY!!!') (:div :class 'huge-sign 'ENLARGE YOUR BRAIN 3.2 INCHES!!') (mk-form (name age e-mail) (:div :class 'enticing-form (:input :id name) (:input :id age) (:input :id e-mail)) :action (enlargement name age e-mail)) (:div 'YOU WANT ENLARGE MANY OTHER THINGS?' (:br) (:a :href (get-partner-url referral) 'VISIT OUR TRUST PARTNER')) (:br) (mk-act (let ((card-num (prompt 'your visa for tiny fee'))) (if (validate card-num) (redirect 'investment name e-mail age) (set-target tar1 :caption 'DON'T YOU SCAM US!!' :cuss-word (random-cuss-word)))) :caption (mk-target tar1 ((caption 'OR PARTNER US FOR BIG MONEY!!') cuss-word) (:span caption cuss-word))))))) This demonstrates a typical use of the templating system. The 'enlargement' action provides an entry point into the application. User is redirected to an error page if arguments don't match. 'mk-form' creates a channel that redirects back to 'enlargement'. 'mk-act' takes as its first argument an s-exp generate javascript. If a waction is called inside 'mk-act', the generator outputs an AJAX remote function call that transparently return control and result back to client javascript. 'waction' and 'jaction' defines, respectively, actions that are mostly server-scripting or mostly client-scripting. ---Libraries--- I will build on these libraries: TBNL - web front-end CL-INTERPOL and CL-PCRE - String support CLSQL - database interface PostgreSQL - database CL-WHO - templating Parenscript or Peter Seibel's javascript macros AJAXLST - XLST transform DOJO or Prototype - AJAX support ---Timeline--- May 8 -> May 22 -Finish the first draft of wisp grammar. May 25 -> June 26 - Implement the first draft (or working subset of it). a) Schema definition polish. (2 days) b) Data manipulation polish. (2 days) c) Template. (18 days) d) Local/remote function call channel. (7 days) July 1 -> July 30 - Choose one extra feature to implement. a) Integrate Prototype. (10 days) b) Schema redefinition. (10 days, if time permits) c) Integrate AJAXSLT. (10 days, if time permits) August 1 -> August 15 - Wrap up. a) Documentation. (5 days) b) Demo. (10 days) ---Bio--- I am a 3rd year cognitive science undergraduate studying at the University of British Columbia in Vancouver. My experience with Lisp is a paltry 6 months, but I'd like to think that learning from the great lisp classics outside school is a more edifying experience than anything one could wish for. I have experience with Common-Lisp, EmacsLisp, and Scheme. I've had too much exposure to Java from school, and a very unpleasant experience programming a friendster clone in J2EE. On the positive side, Ruby on Rails was my first programming experience that gave me pleasure. I am a fairly recent Linux convert. After much pain and suffering since I quitted Windows cold-turkey, I now can competently manage my machine and write reasonable scripts.