[Openmcl-devel] create an executable from openmcl

Gary Byers gb at clozure.com
Thu Apr 17 08:27:44 PDT 2003

On Thu, 17 Apr 2003, Taoufik Dachraoui wrote:

> Hi,
> Can I create an executable program file from openmcl?
> example:
> (defun add3 (x) (+ x 3))
> (loop do (format t "~A~%" (add3 (read)))) ;;  entry point
> I would like to create an executable program (smallest) with the
> expression above as the entry point of the program.
> Kind regards
> Taoufik

--------- begin actual unretouched screen capture --------
[src/ccl] gb at miles> openmcl
Welcome to OpenMCL Version (Alpha: Linux) 0.14-030415!
? (defun add3 (x) (+ x 3))
? (save-application "adder.image"
                    #'(lambda () (loop do (format t "~A~%" (add3 (read)))))
? [src/ccl] gb at miles> openmcl adder.image
--------- end actual unretouched screen capture --------

It'd be tempting to say that it's that easy, but that wouldn't be
entirely accurate: we've left out some interesting details (what
happens if there's a runtime error ? how should ^C be handled ? how do
we get out of this loop gracefully ?)  SAVE-APPLICATION can pretty
clearly handle the demands of ADD3, but as things start to get a
little more complicated (what if we wanted to write "ADD-N", where N
was passed via a command-line option ?)  I'm not confident that things
are modularized well.

This happened to have been in 0.14; 0.13 would probably behave exactly
the same way on the example, but there are likely different ways in
which things aren't modularized well.

As far as making a "minimal" adder.image ... it's strange to hear
myself say this, but I think that the modularity and infrastructure
and other issues (packaging, distribution) are way more important.
There are certainly arguments that suggest that a 5MB ADD3 program is
somewhat excessive, but if it's a -really good- ADD3 program most
people wouldn't care that it happens to have a (mostly unused) CL
implementation in it.  Would they ?

Openmcl-devel mailing list
Openmcl-devel at clozure.com

More information about the Openmcl-devel mailing list