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] |
bothner@cygnus.com writes: > > Another concern was that DSSSL (and, as I've since learned, MIT > > Scheme) use special #!optional, #!key and #!rest keywords. > > And Kawa, and Bigloo, and maybe others. > Well, I'd be happy to change it in my optargs stuff if anyone can suggest a way to handle both #! as an interpreter indicator and as the prefix to #!optional, #!key and #!rest in a sufficiently clean way (I guess this would really mean, clean enough to satisfy Jim, rather than clean enough to satisfy me). > > Since #! _must_ be used as a block comment specifier at least at the > > start of scripts, > > Another solution is to steal scsh's "meta-arg" idea: > > If a command-line argument is \, then Guile read the *second* > line of input, and replaces the \ the the arguments found there. > Thus if foo starts out with: > > #!/usr/local/bin/guile \ > -e main -g > (define (main ...) ...) > > and is invoked as: > foo a b c > then guile would be invoked as if called by: > > /usr/local/bin/guile -e main -g foo a b c > > (I don't know the actual arguments supported by Guile, so ignore those.) > > This avoids any hackish syntax rules for #! - rather the \ argument > is defined to cause it to skip the first line, process the second > line for command arguments, and then evaluate the remainder of the file. > AFAIK, Guile already does this but requires a terminating !# line after the meta-arg line. IMO, 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 also see nothing "hackish" in defining a special meaning for #!/ > - it is nothing fundamentally uglier than the difference between > #f and #\f. > Maybe this is just my own warped twisted view, but I've always thought that for hash syntax in Lisp-like languages in general, things that have the same character following the hash should be related to each other in some way. #f and #\f follow this rule. However, if, say, #f were the false value and #f\ were the character `f', I would be shocked and dismayed. The goal of the hash prefix syntax was supposed to be to keep the necessary dispatch in the reader (both `read' and the human reader) relatively simple. But, as I said, if find a way to tell the difference between #!/usr/bin/guile and #!optional that convinces Jim, you'll have convinced me. - Maciej