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

Re: Several comments

This page is part of the web mail archives of SRFI 22 from before July 7th, 2015. The new archives for SRFI 22 contain all messages, not just those from before July 7th, 2015.

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

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

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

(define main (lambda (argv)