Miles Egan <miles@...> writes:
> Deploying sbcl programs is a bit of a hassle at the moment. I have to
> bootstrap all my apps from a shell script, which seems clunky.
> sb-executable seems pretty clunky too.
Can you elaborate on the problems with sb-executable? Sure, it's a
hack, but you should only have to do it once, right?
> It would be great if I could just do:
> (format t "Hello World!~%")
> And have it work.
> After toying around with the toplevel-init stuff it looks like all it
> would take to make this work is the following:
> 1. Define #! as a new dispatch macro that just discards up to end of
> 2. Adjust toplevel-init to check to see if there's an argument left
> after option processing and (load) it if so, instead of passing it on
> as a program argument.
OK, well, here's the thing. ANSI specifically frees #! as a readmacro
that is free for the user; the implementation is not allowed to define
it by default. So we're never going to get to your state of grace as
above. On the other hand, the two issues above could be solved in one
go; something like
#! /usr/bin/sbcl --script
might work, where --script is syntactic sugar for "set up #!
readmacro then load the argument as a file".
> I guess the downside of doing this is that programs that rely on the
> current behavior to pass command-line arguments. Perhaps the impact
> of this could be minimized by specifying that the special "--"
> argument means that all following arguments are to be passed on as
> Another side benefit of this is that "sbcl foo.lisp" loads and runs
> foo.lisp, which is what anybody coming from a perl/python/ruby etc
> background is going to expect.
I'm not convinced that encouraging this is that great an idea, on the
dual basis that firstly, lisp's strength isn't in unattended mode, and
on the other hand, "sbcl <foo.lisp" already works as in other
> Any opinions? I'd be happy to take a stab at a patch if people don't
> think this is too drastic.
I hope this doesn't pour too much cold water on your enthusiasm. :-)
http://www-jcsu.jesus.cam.ac.uk/~csr21/ +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%") (pprint #36rJesusCollegeCambridge)