On Mon, 2009-06-01 at 13:16 +0300, Abdulaziz Ghuloum wrote:
> On Jun 1, 2009, at 12:41 PM, Derick Eddington wrote:
>
> >> How would you change the
> >> options if we want an explicit "--load"?
> >
> > "ikarus --repl --load <file>*" loads the files into an interaction
> > environment of (import (ikarus)) and then starts a REPL in that
> > environment.
> >
> > "ikarus --load <file>*" loads the files into an interaction
> > environment
> > of (import (ikarus)) and then exits.
In order to pass through arguments when using --load, I suppose "--"
should work with it:
ikarus --load <anything-except-"--">* -- <anything>*
and <anything>* becomes (cdr (command-line)).
Or, should --load take exactly one file and multiple "--load <file>" can
be given in sequence, so that "--" can be both a file to load and an
escape for passing through the rest:
ikarus --load foo --load -- -- <anything>*
and "foo" and "--" are files to load and <anything>* becomes
(cdr (command-line)).
Otherwise, this is ambiguous:
ikarus --load foo -- <anything>*
because is "-- <anything>*" files to load or escaped arguments to pass
through? Full generality requires "--" to be a possible file to load.
If --load takes exactly one file:
[Now it gets annoying.]
I suppose
ikarus --load a --load b foo bar
should pass through '("foo" "bar") as (cdr (command-line)) because they
don't look like options.
And I suppose these should be errors:
ikarus --load foo --not-for-ikarus
and
ikarus --load foo bar --not-for-ikarus zab
because "--" should have been used to escape option-appearing arguments.
But what about
ikarus --load foo --repl
?
I suppose Ikarus-options should be allowed in any order (or course,
--r6rs-script always consumes everything after it) because "--" can
escape anything.
And what about
ikarus --load foo bar -- --not-for-ikarus
Should (cdr (command-line)) be '("bar" "--not-for-ikarus")?
Or should it be an error because "bar" is not an Ikarus-option and it's
before "--"?
Having --load consume everything after it up to the first "--", and
thereby excluding "--" as a possible file to load, is probably worth
avoiding all the above corner cases.
--
: Derick
----------------------------------------------------------------