This is the mail archive of the
guile@sources.redhat.com
mailing list for the Guile project.
[comp.lang.scheme] Re: I'm allergic to anything Java
- To: guile at sourceware dot cygnus dot com
- Subject: [comp.lang.scheme] Re: I'm allergic to anything Java
- From: thi <ttn at netcom dot com>
- Date: 27 Jul 2000 13:07:00 -0700
anyone want to port brl to guile?
thi
------- Start of forwarded message -------
From: brlspam@sperience.com
Newsgroups: comp.lang.scheme
Subject: Re: I'm allergic to anything Java
References: <okfg0ovvhgy.fsf@bellsouth.net>
Date: 27 Jul 2000 12:52:06 -0400
Message-ID: <nm91z0fldmx.fsf@kindness.mit.edu>
Organization: MIT Alumni
David Rush <kumo@bellsouth.net> writes:
> No, really. I mean it. So how Kawa-dependent is BRL? Is it conceivable
> that it might run under any other R5RS environment?
First, let me say that once you get BRL up and running you are free to
forget about Java.
It is conceivable that BRL could be implemented with a different Scheme
implementation, but I think the database-independent part would be
harder to implement with ODBC than it was with JDBC. Kawa's
behind-the-scenes compiler really helps too, but it's conceivable that
some Scheme interpreters might run faster than the JVM-compiled code.
> I've finally got a
> billable excuse to write some Scheme in a web app
Cool! I'm happy for you. I'm lucky enough to do this all the time.
BRL is a great tool for "Scheme in a web app". There are other systems
like LAML for making the web app be Scheme from the ground up. You
probably know that, but I mention it for the benefit of others reading.
> but getting a
> working Java environment (JVM
Sorry, no getting around having a JVM.
> & JDK
You can get Kawa and BRL precompiled and never worry about JDK. Kawa
does its compiling independent of the JDK.
> versions
It's unlikely you'll find a version that won't work with BRL and Kawa.
Can't guarantee the same re. your JDBC driver, assuming you're using
one.
> magical paths, jar files...)
Yes, figuring out how to set the servlet engine's CLASSPATH is one of
the tricky parts of the process.
> makes me itch. Help!
Well, maybe you can find someone who likes Java and say, "I've decided
servlets are the way to go on this project. Can you help me get one set
up?" Then later you can forget what a servlet is.
But if you can't find someone who likes Java, it might be your best bet
to implement BRL on top of your favorite Scheme implementation. I did
it, so it can't be that hard. :-)
The first thing you need to do is write brl-read that extends regular
Scheme read. Strings can begin with " and be escaped the regular way.
They can also begin with ] or the beginning of a file, and [ is escaped
by doubling it. You don't have to disable the square-brackets-as-parens
extension in most Scheme implementations to make this work, but if you
like to use square brackets that way yourself, choose different chars
for brl-read.
Next write brl-readall that uses brl-read to get all the expressions
from a template file into a list, trying to preserve line/column info in
the same way your Scheme implementation does to aid debugging.
E.g. this template file:
______
Two plus two is [(+ 2 2)]!
______
is read into
("Two plus two is " (+ 2 2) "!")
Next you need a macro or something to create a sequence of expressions
like (display expr web-output-port), except that set! expressions,
etc. are not transformed into display expressions. All these
expressions get wrapped up into a lambda expression, which you then eval
to get a procedure that can be used to handle page requests.
If your implementation supports R5RS macros, you could easily adapt it
from the brl-make-nal procedure in progfun.scm in the BRL source
distribution.
The web integration part shouldn't be too hard if your Scheme
implementation includes its own web server. You just need a procedure
that takes a request, checks to see if the corresponding template file
has been modified and re-read/eval if so, then apply the resulting
procedure to the form inputs (if any).
After that, you'll be ready to start showing people how fast/well
template-driven web apps can be developed when the templates don't look
like line noise. Have fun! I sure am.
--
(for-each (lambda (str) (display (string-append (make-string (- 40
(quotient (string-length str) 2)) #\space) str)) (newline)) '(""
"Bruce Lewis" "MIT 1990" " http://brl.sourceforge.net/
"))
------- End of forwarded message -------