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

Re: MIME for Dylan sourcecode?



In article <bruce-8CB2CC.08530703092001@news.akl.ihug.co.nz>, Bruce 
Hoult <bruce@hoult.org> wrote:

> It's a pain that even the simplest Dylan program needs several source 
> code files.  This makes life harder for beginners, makes Dylan less 
> suitable as a scripting or CGI language, and even keeps Dylan off a 
> certain well-known progrmaming language comparison web page.

I'll immediately follow-up to my own message and add that I'd also love 
to see some way to make Dylan programs executable within the standard 
Un*x framework.  So, you might end up with something like this:

[localhost:~] bruce% cat cgitest.cgi
#!/usr/local/bin/d2c --auto-run
library: cgitest
executable: cgitest
MIME-Version: 1.0
Content-Type: multipart/mixed;
              boundary=-------

-------
module: dylan-user

define library cgitest
  use common-dylan;
  use io;
end library;

define module cgitest
  use common-dylan;
  use format-out;
end module;
-------
module: cgitest

do(compose(format-out, rcurry(concatenate, "\n")),
   #["Content-type: text/html",
     "",
     "<html>",
     "<head><title>Dylan CGI</title></head>",
     "<body><h1>Hello from a Dylan CGI!</h1></body>",
     "</html>"])
-------
[localhost:~] bruce% 


I suspect that the bang-shriek line might upset true MIME-compliance, 
but 1) it's clearly pretty easy to teach a Dylan compiler to ignore it, 
and 2) there's always "tail -n+2"...

-- Bruce



Follow-Ups: References: