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

Re: Several comments

Marc Feeley <feeley@xxxxxxxxxxxxxxxx> writes:

>   #! /bin/sh
>   "exec" "scheme-script" "$0" "$@"
>   (define (main arg1 arg2)
>     (write (+ (string->number arg1) (string->number arg2))))
>   (apply main (command-line-arguments))

I prefer this approach.  I think it is more compatible with the
traditional "load".

The Kawa compiler can take this kind of script, and if you compile
it with --main you get a stand-alone Java application.  If you load
it, you get the behavior expected of the script. I don't think the
rationale for easier debugging is strong enough to compensate for
a clumsier and less traditional interface.

I think "script-arguments" is not a good name.  What is a "script"?
Why the word "script" as apposed to "program" or "application"?
"command-line-arguments" is both more descriptive and avoids the
"script" vs "program" issue.  It is so descriptive that both Scsh
and Kawa use it - but they use it for a global variable.  Using it
for a function would clash.  Scsh does have "(command-line)" which
returns the complete command line, including the name the script
was executed as.
	--Per Bothner
per@xxxxxxxxxxx   http://www.bothner.com/~per/