Why Lisp is Now an Acceptable Scripting Language
Steve Haflich
shaflich at gmail.com
Mon Mar 3 01:50:01 UTC 2014
A quarter century ago I devised similar machinery for Allegro. It's still
in the implementation, and I use it daily for personal scripting tasks:
http://franz.com/support/documentation/current/doc/startup.htm#starting-unix-script-3
Your work is a very useful thing to have, but let me suggest there are
additonal issues to consider.
The Allegro machinery allows a compiled file to be included as the
application. This eliminates the time necessary to cl:read the source and
compile the definition on systems that automatically compile. For many
scripting applications none of this matters. For most purposes interpreted
executions, and/or the compiler, now require such inconsequential time that
one shouldn't care how the deed gets done. But there are situations where
it might:
If the script does nontrivial computation, the difference between
interpreted and compiled execution might matter. (For implementations that
always compile, the compilation cost is fixed, but happens upon each
execution.)
If the script is executed with high frequency, perhaps as the
implementation of a web page, the cost of launching a heavyweight Lisp
image in almost _any_ implementation is likely to be objectionable. A
lightweight C a.out has a small footprint in addition to the various .so
libraries it uses, which will tend to stay loaded, and requires minimal
startup execution overhead. Most Common Lisp applications have a larger
startup cost because Lip environments are, shall we say, bigger and more
capable.
It would be nice to think further how startup overhead could be reduced
with precompiled execution
On Sun, Mar 2, 2014 at 2:56 PM, Faré <fahree at gmail.com> wrote:
> My cl-launch demo:
>
> cl -sp lisp-stripper -i '(print-loc-count "asdf.lisp")'
>
> Source code for lispwc:
> #!/usr/bin/cl -sp lisp-stripper -E main
> (defun main (argv)
> (if argv
> (map () 'print-loc-count argv)
> (print-loc-count *standard-input*)))
>
> And of course:
> for l in sbcl ccl clisp cmucl ecl abcl \
> scl allegro lispworks gcl xcl ; do
> cl-launch -l $l -i \
> '(format t "'$l': ~S~%" `#5(1 ,@`(2 3)))' \
> 2>&1 | grep "^$l:" # LW, GCL are verbose
> done
>
> Backstory:
>
> After recent exposure to Python at work, I grew an intense dislike for
> that language, and realized that I could do everything in CL instead,
> and that the remaining stumbling blocks to using CL as a "scripting
> language" were quite small — just missing the ability to put
> #!/usr/bin/cl in a script, and there you go.
>
> And so, I added just this capability to cl-launch, improved it to have
> some of the features of buildapp, and made sure it works without a
> hitch on each of the 11 implementations with a command-line interface.
> This in turn requires updating ASDF and UIOP, and so here we are with
> ASDF 3.1.0.86.
>
> Then, I found that I had to take the word out, and started editing
> that way a paper that I'm preparing a paper for ELS 2014 (or else ILC
> 2014):
> ASDF3, or Why Lisp is Now an Acceptable Scripting Language
>
> It's incredible how having to explain the code forces you to make it
> actually simpler to use. Hence new option -sp in cl-launch, to load
> a system and change the current package, all in one go. Hence also
> having cl-launch build software with a sequence of --system --load --eval
> instead of a single setup file and toplevel system like before:
> people already understand a sequence of build commands.
>
> Also new in ASDF3: command line argument support was improved with a
> LispWorks workaround and a new argv0 function; with-input and
> with-output accept pathnames as designating a file to open; the bundle
> support was much improved and cleaned up; the upgrade mechanism was
> slightly improved to cope with the class refactoring; bugs were found
> and removed in pathname functions; a weird bug in SCL was worked
> around.
>
> Enjoy!
>
> TODO: I'm considering modifying the default behavior of cl-launch to
> launch a REPL and/or read commands from stdin, like a Unix shell does
> when given no script and no commands to run. I'm reserving that for
> another round of procrastination.
>
> —♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics•
> http://fare.tunes.org
> To have a right to do a thing is not at all the same
> as to be right in doing it. — G.K. Chesterton
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/pro/attachments/20140302/599beed9/attachment.html>
More information about the pro
mailing list