guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Running non-scheme scripts: some thoughts


From: Ian Price
Subject: Running non-scheme scripts: some thoughts
Date: Wed, 11 Jul 2012 16:31:15 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Hi,

Though guile is really a multi-language vm, it does not provide a simple
way to run scripts for languages other scheme from the command line. I
think we should add a --language switch that takes a mandatory argument,
and use that to determine the language.

Other solutions for dealing with multiple languages have been proposed
before, including guessing the language from the file extension[0], or from
the file itself (via a something like racket's #lang).

While guile could move towards those at a later date, I think the
--language switch is a good one for now. Firstly, it could be
implemented simply with, I think, only modifications to (ice-9
command-line). Secondly, it is compatible with these other designs; a
future language guessing guile could honour --language, and where that
switch is not provided would be free to guess; a similar situation
would occurs if we went with a #lang type solution.

Anyway, some thought needs to be taken as to how this will integrate
with the other switches. In particular: -s, -c, -l, -e, and maybe
--listen, -q, and --use-srfi.

I think that if --language=LANG is specified, then the files given by
-s, and -l should be treated as though they contained LANG source
code. Similarly, the string argument to -c, as a string of LANG. -e
would ideally be a function in LANG, but I don't know the details of how
this works in the other languages, and so could be left off for now.

If guile was used interactively with the --language switch, it would
give you a guile repl already in that language, similar to if we did ,L.
I think this is how it should interact with --listen too, though I'm not
positive.

-q, or rather, when -q is not supplied, is tricky. I think we should
just assume that it is always going to be in Scheme. I'm open to
suggestions.

I don't know how module interaction works in other languages, so I also
can't comment on the suitability of --use-srfi.

So, thoughts? Counter-proposals? Flames? Have I missed out anything
particularly obvious?


tl;dr +1 to add a --language switch to guile :P


[0]. I don't personally like this solution, since it seems fragile, and
it's not clear how it would interact with the -x switch.
-- 
Ian Price

"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

[Prev in Thread] Current Thread [Next in Thread]