BRL Speeds Web/DB Integration
          Bruce Lewis
       Senior Programmer
    Eaton Vance Management
brlewis@users.sourceforge.net
      O'Reilly OSCon 2000

About This Talk
Not a ``How-To'', but a ``Why''
□ Experience that motivated BRL
□ Evolution to a compiled system
□ Examples of BRL's simplicity

cgiemail templates (1995)
To: strangeman@chasm.big
Subject: questions three
What is your name?      [yourname]
What is your quest?     [quest]
Your favourite colour?  [colour]

Benefits of releasing free software
□ Bugs fixed before MIT saw them
□ User-contributed enhancement
□ Documentation Quality Assurance
□ New hire needed no training

Idea to redo cgiemail
□ Some mechanism to combine functions
□ Parsing should remain simple
□ Only one special character
□ Scheme syntax

Introducing Scheme
□ Think expressions, not commands
□ Same syntax for every function
□ Variable substitution like cgiemail
□ Conciseness helpful in templates

Think expressions, not commands
> "Hello, World"
Hello, World
> (define h "Hello, World")
> h
Hello, World

Same syntax for every function
> (string-append h "!!")
Hello, World!!
> (+ (* 2 3 4) 5 6)

> (define (quiz op n1 n2)
    (display "Your answer? ")
    (if (equal? (op n1 n2) (read))
        "Correct!"
        (op n1 n2)))
> (quiz * 2 3)
Your answer? 6
Correct!

■ Think expressions, not commands
■ Same syntax for every function
□ Variable substitution like cgiemail
□ Conciseness helpful in templates

Not a ``How-To'', but a ``Why''
■ Experience that motivated BRL
□ Evolution to a compiled system
□ Examples of BRL's simplicity

BRL 1 (1997)
<pre>[(html-repeat
    (sql "select * from favcolor"))]</pre>
<ul>
  <li>[name] likes [color]
</ul>

Problems with BRL 1
□ Oracle only
□ One-second response with light load
□ Little potential for compilation
□ Inspiration:  Dynamo

http://www.gnu.org/software/kawa/
□ Easy-to-use Scheme compiler
□ Java base enables JDBC
□ Free software
□ Responsive maintainer

Eaton Vance, free software publisher
□ ``What others use'' mentality
□ cgiemail free-software essay
□ Legal department analysis of GPL
□ CEO sees no downside to it

Not a ``How-To'', but a ``Why''
■ Experience that motivated BRL
■ Evolution to a compiled system
□ Examples of BRL's simplicity

<body>
  [(inputs word)]
<p>[word] spelled backwards is
   [(list->string
       (reverse (string->list word)))]
</p>
</body>

Centralized SQL Configuration
(sql-driver "com.internetcds.jdbc.tds.Driver")
(define (db1 brl-context)
  (brl-sql-connection brl-context
     "jdbc:url-here"
     "user-here" "password-here"))

<ul>
 [(define rowcount
    (sql-repeat st (name color)
      ("select * from favcolor")
      (brl ]<li> [name] likes [color]
 [)))]
</ul>

[(exmail '("strangeman@example.com")
   (string-append
]From: [email]
To: strangeman@example.com
Subject: questions three
What is your name?      [yourname]
What is your quest?     [quest]
Your favourite colour?  [colour]
[))]

Not a ``How-To'', but a ``Why''
■ Experience that motivated BRL
■ Evolution to a compiled system
■ Examples of BRL's simplicity

More Examples
http://brl.sourceforge.net/
Discussion
1.  comp.infosystems.www.databases
2.  comp.lang.scheme
3.  brl-users@lists.sourceforge.net