[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: loading additional code

On Sun, Jan 06, 2002 at 04:40:43AM +0300, Kirill Lisovsky wrote:
> Hello!
> On Sat, 5 Jan 2002, Wojciech Sobczuk wrote:
> > i'm currently developing a http server in mzscheme.  it already serves static
> PLT provides a http server in mzscheme. 
> What is the rationale behind this new implementation?
> (Just curious)

well, the main reason is to learn programming Scheme while doing something
interesting.  i've only been doing imperative programming for the last 6 years,
and started having fun with lisp 2 months ago or so, and now i'm into scheme,
since i'm going to use it while programming CLIPS (an expert system shell),
Festival (a text-to-speech system) *AND* i need a nice environment to complete
two large web projects (and i also need to convince others that it's better
than PHP which 'everyone knows')..

> On Sun, 6 Jan 2002, Wojciech Sobczuk wrote:
> > On Sat, Jan 05, 2002 at 11:49:29PM +0100, David N. Welton wrote:
> > [..snip..]
> > > 
> > > > i'm also planning to develop some kind of JSP equivalent for scheme.
> > > > i don't think custom tags will be needed, because scheme is so
> > > > readable and 'natural' that it can be seamlessly included in the
> > > > HTML code like:
> > > 
> > > > 	<(reqparam "foo")>
> > > > would display a request parameter "foo", contrary to the long and dirty
> > > > java code for the same:
> > > > 	<%= request.getParameter("foo") %>
> > > 
> > > <? ?> are the correct markers to use for processing instructions in
> > > xml, possibly accompanied by an identifier like this:
> > > 
> > > <?mzwebscheme 
> > > (display "hello world")
> > > ?>
> > 
> > true!  but my main aim is - make it simple, developer friendly and quick to
> > work in.  i'm tired of all this formalism which doesn't give anything.
> > i'm the one parsing the document - why not use <(.  java people didn't fear to
> > use % instead of ?, why would i?
> > if i use '(' - it will embed scheme really nicely into the page - because a
> > programmer would have to write the '(' to start a piece of scheme code.
> >
> Documents containing <( ... )> or <% ... %> are not weel-formed XML document,
> while <?mzwebscheme s-expr ?> is proper XML PI (prod. 16 of W3C XML Rec.).
> Which makes it possible to use XML/XHTML processing/editing tools on the documents
> containing <? but not <( or <% . So, this formalism gives something.
> Shorter PITarget (say, 'mz' instead of 'mzwebscheme') may be more developer
> friendly. 

i'm not saying that i won't allow <?mzwebscheme ?> or similiar, i'm just saying
that i want to allow the simplest form available for programmers to use.
i'm tired of excessively formalized systems like J2EE in which one spends more
time writing up the formal documents/classes than doing the actual programming.
besides, i can provide a converter which would change he <( to <?mzwebscheme (,
providing an easy way to change all the files to be standards compliant.

so, summing up, i want to use the machine for what it's job is - doing all the
hairy details that can be done automatically. instead of making the programmer
do it.

> Using XML element abd dedicated namespace may be a solution also. 
> <mz:scm> S-expr </mz:scm>
> I do agree that one-liner
> <h1><(+ 2 2)></h1>
> is looking more pleasant than 
> <h1><?mzwebscheme (+ 2 2)?></h1>
> or
> <mz:scm>(+ 2 2)</mz:scm>

yes!  i've just had a brief look at a LAML paper - the good idea inside seems
to be:
	<mz:sometag a "bcd" e "fgh"> content </mz:sometag>
translates to:
	(sometag 'a "bcd" 'e "fgh" content)

the hard part is that any time we move to using some kind of tags, from actually
writing code in the webpage (which i'd like to avoid) - we come to a point where
something we need to do can't be easily done with tags.  like accessing session
and request variables.  in my Java taglib library i had the tag handler process
the tag's argument and finding strings preceded by a '$' sign and then replacing
those with the value of a request parameter named as the string following the '$'.
but that isn't really flexible too.

so.. i don't really know where should we place the border between html and
scheme - to make it both usable, to some extent, by html people and place
as little code as possible in the html document itself.

a good idea would be to let the user easily extend the initially provided tag
library, and this could actually be a solution to the whole problem, so if 
the user wanted to print 2 request variables, he would simply write:
	<mz:printtag "abc" "def">
in the html file, and provide a printtag.scm placed inside the mz/ subdirectory
in the taglib directory, which would contain:
(define printtag
  (lambda (args)
    (for-each (lambda (arg) (request-parameter arg)) args)))

so the above html code would be compiled into:
(printtag "abc" "def")
and nicely executed.

the problem here is that we're not standards compliant (no tag parameter names
- but there must be a simple, and standards compliant, way to represent a list
inside a HTML tag??

> but for a larger document blurred distinction between 
> <h1><(+ 2 2)></h1>
> and
> <h1>(+ 2 2)</h1>
> may be a disadvantage.
> > > 
> > > > is this the right way to go?  or perhaps i should experiment with
> > > > XML related code in http://pobox.com/~oleg/ftp/ and go some other
> > > > way?
> Olegs's SSAX provides support for PIs and namespaces both.
> SXPath may be also interesting in this context.

yes, it surely will be helpful if we use the new-html-tags-in-a-namespace

> > > You might also look at things like 'BRL' which do web/scheme (he uses
> > > Kawa though, if I'm not mistaken).
> LAML (uses mzscheme)
> JScheme (former SILK) 
> HB
> autogen
> mod_lisp
> are other examples...

these resources are _very_ interesting.  thanks :)

> Best regards,
>           Kirill.