From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ian Price Newsgroups: gmane.lisp.guile.devel Subject: Re: non-scheme scripts: proposed solutions and their pros/cons Date: Sun, 25 Nov 2012 16:06:16 +0000 Message-ID: <874nkdd5vr.fsf@Kagami.home> References: <87boesxyfp.fsf@googlemail.com> <877gpgxnl3.fsf@googlemail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1353859593 3490 80.91.229.3 (25 Nov 2012 16:06:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Nov 2012 16:06:33 +0000 (UTC) To: Guile Mailing List Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Nov 25 17:06:45 2012 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TcejF-0002LG-4A for guile-devel@m.gmane.org; Sun, 25 Nov 2012 17:06:45 +0100 Original-Received: from localhost ([::1]:39644 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tcej4-0004iG-6d for guile-devel@m.gmane.org; Sun, 25 Nov 2012 11:06:34 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:36030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tcej1-0004hs-TT for guile-devel@gnu.org; Sun, 25 Nov 2012 11:06:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tcej0-0001Xz-TQ for guile-devel@gnu.org; Sun, 25 Nov 2012 11:06:31 -0500 Original-Received: from mail-wi0-f173.google.com ([209.85.212.173]:49905) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tcej0-0001X7-NB for guile-devel@gnu.org; Sun, 25 Nov 2012 11:06:30 -0500 Original-Received: by mail-wi0-f173.google.com with SMTP id hn17so1980361wib.12 for ; Sun, 25 Nov 2012 08:06:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version:content-type; bh=J3N3mymec9EpAReudPVa3N3lx4tJk1ZzL4teomasX54=; b=TdmFh5Yn37DGb7UgqcDvz4lhp2MVR4NIq/IvT15FEm5w7TJhm0ixSwpYo5+SyShXbL D3mVQrZW9qVtqjuUBeRvPXNxpBedKRLi+QqtezxHecHHm4u4/52TgouYMTuYlWobY3ni myL5Gilind42tN9S4I5OnGwHBF/HvJmwfIpZhp1/1bRvYsjqdEEFD7ZAsi9h9/Iby8uz 1m/6a0WnQsGldLiLAYMxMf3+FsGn1lwfZX01E9MiAwCE304knHRuvqlELxQ67465liFq /CNdQSayUwFKwo5hmuxL9S5iKNCtkdV8cFumj7ATWBlAvG2KKdgEQ2WtJyCe+VTJ4dCb HVfQ== Original-Received: by 10.216.227.98 with SMTP id c76mr3691514weq.31.1353859589996; Sun, 25 Nov 2012 08:06:29 -0800 (PST) Original-Received: from Kagami.home (host86-182-157-241.range86-182.btcentralplus.com. [86.182.157.241]) by mx.google.com with ESMTPS id eu8sm17388363wib.1.2012.11.25.08.06.19 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 25 Nov 2012 08:06:20 -0800 (PST) In-Reply-To: <877gpgxnl3.fsf@googlemail.com> (Ian Price's message of "Tue, 20 Nov 2012 16:10:00 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.212.173 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:15249 Archived-At: Ian Price 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"