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

MIME for Dylan sourcecode?



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 wll-known progrmaming language comparison web page.

The DRM says little or nothing about the overall format of source code 
files.  Dylan is intended to be compatable with environments in which 
the source code is kept in a database, rather than in text files.

Apple Dylan used a database, converting to text files only for 
import/export.

The two current implementations (Functional Developer and Gwydion Dylan) 
both are text-file only.  There is currently an agreed common format for 
source files and "library definition" files, both of which consist of 
essentially RFC82-like header lines followed (in the case of source code 
files) by a blank line and then the actual Dylan source code.

This similarity to RFC822 makes me wonder whether it would be 
appropriate to extend this to allow the current three+ text files (LID 
file, exports file, source code file(s)) to be combined into a single 
text file using MIME.

So, for example, the current Gwydion make-dylan-app script might create 
something like this:


library: helloworld
executable: helloworld
MIME-Version: 1.0
Content-Type: multipart/mixed;
              boundary=-------

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

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

define module helloworld
  use common-dylan;
  use format-out;
end module;
-------
module: helloworld
synopsis: 
author: 
copyright: 

define function main(name, arguments)
  format-out("Hello, world!\n");
  exit-application(0);
end function main;

// Invoke our main() function.
main(application-name(), application-arguments());
-------


Now, I'm no expert on MIME, so I'm not sure whether this is valid 
conforming MIME, or if it is whether this is the best way to represent a 
Dylan program using MIME.  What I'm doing is basically taking our 
current .lid file format, taking out the "files:" header (since the 
files are now inline), and adding MIME headers.  I'm taking advantage of 
the default body format for mime being the same as if "Content-type: 
text/plain; charset=US-ASCII" was explicitly included.  Perhaps some 
compilers might want to recognize other formats as well.

I'd like to see discussion on this, including enhancements and of course 
corrections of any idiocies I've commited.

If we can get some sort of agreement then I'd be happy to do the work to 
modify d2c to accept files in this format.

-- Bruce



Follow-Ups: