Ian Price <ianpric...@googlemail.com> writes:

> First, I'm going to try and write a proof-of-concept guile-elisp
> executable. This shouldn't be too hard, I think, and may shed some light
> on expected difficulties.

I was distracted by the pfds release so it's taken me longer than it
should have, but as expected, it wasn't difficult _once I knew where to
look_. The general template is

#!/usr/local/bin/guile -s
!#

(use-modules (system base compile)
             (system repl repl))

(let* ((args (command-line))
       (argv0 (car args))
       (files (cdr args))
       (load-file (lambda (file)
                    (compile-file file #:from 'elisp #:to 'value))))
  ;; ^^ Imagine sophisticated command-line parsing :)
  (if (null? files)
      (start-repl 'elisp)
      (for-each load-file files)))

Be aware you get lots of warnings if you actually run this, since elisp
overrides a bunch of bindings.
      
Extending it to handle different argv0s seems obvious. Handling -c would
involve loading the relevant reader, and using compile (maybe write that
as a compile-from-string function). -e is a little tricker.

-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"

Reply via email to