This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Optional Arguments (was Re: CVS script)


> Making a terminal \ mean "ignore this
> line and the next" if it is on the first line, when it otherwise is
> just a normal character would be almost as weird as making #! have two
> totally divergent meanings, but not quite.

I think you misunderstand.  I am not proposing any support for \
in the lexer - only in the argument-processing code in main().
I.e. just like "-s" in a command line argument is not handled the same
as how the reader handles it, there is no reason that the \ command
line flag be handled differently than by the Scheme reader.

For backwards compatibility, I think we do want to support the
existing #!...#! syntax as a block comment *at the beginning of
a script file*.  I.e. when Guile is started, with either the -s
or \ flags, the Guile start-up code will check if the file starts with #!,
in which case it will skip forward to the closing !# (with
appropriate meta-arg handling in the case of a \).

However, there is no real need for the *reader* to handle #!...!#
- handling those is only needed to handle script start-up,
which is not handled by the reader anyway.

After all, saying that #!...!# is just a block comment is not
acurate, since that would imply that meta-arg arguments were ignored.

> However, if, say, #f
> were the false value and #f\ were the character `f',

Well, we only need to distinguish #!/ and #! followed by letter.
That is probably the easiest way to do it, though if we follow
my suggestion above, we don't need even to do
that - #!/ would be illegal except at the start of a script.
Though as a convenience, I guess it makes sense for load to
also skip initial #!...!#, since otherwise it becomes a hassle
to load "script files" from the Scheme read-eval-print loop.

I am also flexible in terms how we handle #! (though I am not
willing to remove support for #!optional etc from Kawa).

	--Per Bothner
Cygnus Solutions     bothner@cygnus.com     http://www.cygnus.com/~bothner