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

Re: Several comments



> From: Per Bothner <per@xxxxxxxxxxx>

> 
> 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))
> 
...deleted

> "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.

In an attempt to bring other approaches forth (not to confuse things,
only to show possibilities) I would like to mention that RScheme uses a
fixed name for the script entry point (like 'main' in C). Moreover,
this entry point has a single argument, ie the list of command line
arguments.

So, for a RScheme script to run it needs the following:

(define main (lambda (argv)
	(do-anything)))

bengt