unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Ian Price <ianprice90@googlemail.com>
To: Guile Mailing List <guile-devel@gnu.org>
Subject: Re: non-scheme scripts: proposed solutions and their pros/cons
Date: Sun, 25 Nov 2012 16:06:16 +0000	[thread overview]
Message-ID: <874nkdd5vr.fsf@Kagami.home> (raw)
In-Reply-To: <877gpgxnl3.fsf@googlemail.com> (Ian Price's message of "Tue, 20 Nov 2012 16:10:00 +0000")

Ian Price <ianprice90@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	other threads:[~2012-11-25 16:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-20 12:15 non-scheme scripts: proposed solutions and their pros/cons Ian Price
2012-11-20 13:14 ` Noah Lavine
2012-11-25 16:22   ` Ian Price
2012-11-20 16:10 ` Ian Price
2012-11-25 16:06   ` Ian Price [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874nkdd5vr.fsf@Kagami.home \
    --to=ianprice90@googlemail.com \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).