[plt-scheme] FW: macros vs. blocks

From: Paul Steckler (steck at ccs.neu.edu)
Date: Tue Nov 26 16:03:47 EST 2002

The BRL example below is slightly broken, because it uses state instead
of lexical binding.

The PLT CGI library ought to have something like:

  (with-cgi-bindings (x ...) ...)

which expands to something like

  (let* ([bindings (get-bindings/post)]
         [x (extract-binding/single "x" bindings)]
         ...)
    ...)

When writing CGI scripts, I write boilerplate like this all the time.

-- Paul

-----Original Message-----
From: owner-ll1-discuss at ai.mit.edu [mailto:owner-ll1-discuss at ai.mit.edu]
On Behalf Of Anton van Straaten
Sent: Tuesday, November 26, 2002 1:42 PM
To: Bruce Lewis
Cc: ll1-discuss at ai.mit.edu
Subject: RE: macros vs. blocks

Bruce Lewis wrote:
> A simple example that does #2 and #3 together is BRL's inputs syntax.
>
> (inputs foo bar baz)
>
> is equivalent to CGI.pm's
> foo=param('foo');
> bar=param('bar');
> baz=param('baz');

That's an excellent example.  BRL provides a domain-specific Scheme
superset
for web page authoring, and instead of exposing messy and irrelevant
details
of the CGI API to users - as most systems like ASP, JSP etc. do - those
details have been fully encapsulated by a true abstraction, and handled
transparently by the language (BRL).  It's more concise, more readable,
unambiguous, easier to remember, and easy to explain, without having to
get
into details of APIs that really ought to be hidden.

Anton



Posted on the users mailing list.