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: Tue, 20 Nov 2012 16:10:00 +0000 Message-ID: <877gpgxnl3.fsf@googlemail.com> References: <87boesxyfp.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 1353428155 14705 80.91.229.3 (20 Nov 2012 16:15:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 20 Nov 2012 16:15:55 +0000 (UTC) To: Guile Mailing List Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Nov 20 17:16:05 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 1TaqUT-0007MT-To for guile-devel@m.gmane.org; Tue, 20 Nov 2012 17:16:02 +0100 Original-Received: from localhost ([::1]:47510 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TaqUJ-0000y7-IP for guile-devel@m.gmane.org; Tue, 20 Nov 2012 11:15:51 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:36559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TaqTw-00006A-C0 for guile-devel@gnu.org; Tue, 20 Nov 2012 11:15:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TaqTs-0005rh-0U for guile-devel@gnu.org; Tue, 20 Nov 2012 11:15:28 -0500 Original-Received: from mail-wg0-f49.google.com ([74.125.82.49]:34121) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TaqTr-0005rb-NM for guile-devel@gnu.org; Tue, 20 Nov 2012 11:15:23 -0500 Original-Received: by mail-wg0-f49.google.com with SMTP id gg4so2718540wgb.30 for ; Tue, 20 Nov 2012 08:15:23 -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=LAISKZ19vqIVQNNeSdSo/DTJN55KgAyv2MwNOUKLPGs=; b=cuyhcz2BNx4lK5aQ4C2ipW9zs0M0Ys6OJ3mzOuvkW6BBinnAnQzpf9nhjlomHd44VK Qao+WnM9XJiFdwD9Kcee05xMlzmL5RqTSEKIMzv6gro9vlYisTiRS0CQBgg9wgxrMPlS RiEp4PDEJFXcUb/3orHTlijYrGnx/8+d2PlwAgEWtLTfUisSaCRTRuyuhy+3EQXztAXH y7yZTgSGKt5CMP7yLP0idrVx36Yl5WRA92jfcnQQTkvU4G1dhCO7MFO1vdCEWICSXxuO 3ojCOayo3PDsvoPuOrXjmoNltOaWoSAQe2CR3//On/fvdxk1+/e6iB1DOhW9Z5movBg2 EYvw== Original-Received: by 10.180.24.4 with SMTP id q4mr15291800wif.19.1353427809089; Tue, 20 Nov 2012 08:10:09 -0800 (PST) Original-Received: from Kagami (host86-174-103-169.range86-174.btcentralplus.com. [86.174.103.169]) by mx.google.com with ESMTPS id gz3sm18318284wib.2.2012.11.20.08.10.07 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 20 Nov 2012 08:10:07 -0800 (PST) In-Reply-To: <87boesxyfp.fsf@googlemail.com> (Ian Price's message of "Tue, 20 Nov 2012 12:15:38 +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: 74.125.82.49 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:15218 Archived-At: So, here's the "plan of attack" I'm envisioning for this. Right now, questions of cross-language module referencing can be ignored. I think it is mostly orthogonal to the current goal of running non-scheme scripts. 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. Secondly, the more serious version. While I can't know all the details till I've done the previous stage, here is what I think I need to do. command-line parsing needs to be moved under the language/$lang directories, and a command line parser field added to guile's language objects. Languages that wish to customise it can add one, or we can have a default one that mostly mimics guile's current interface, and allows executing scripts, lines, etc. We may also want to all language objects to specify one or a set of allowed argv[0] names. While I do not know if anyone actually uses it, we will probably need to keep ice-9/command-line.scm functionally intact for backwards compatibility. With this additional layer of indirection[0], we now dispatch to the correct command-line parser based on the argv[0] name, set the repl language etc. etc. One important issue with this is that it is likely to slow down the time it takes guile to boot, however, is should accommodate any user-written languages. The other thing is, I'm not sure how this is going to affect the C code for guile. It _might_ be possible to do this all in Scheme, but until I've tried, I'm going to remain sceptical. If you have a better suggestion please tell me :) 0. as we all know, "in computer science, every problem can be solved with an additional layer of indirection" -- 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"