[r6rs-discuss] [Formal] Conflating programs and scripts

From: Andre van Tonder <andre>
Date: Tue Oct 31 11:26:13 2006

On Tue, 31 Oct 2006, Michael Sperber wrote:

> Of course they are, as scripts weren't part of an earlier standard, so
> nobody could write portable scripts. I conjecture that most existing
> portable Scheme code really corresponds to what's a library in the
> current draft, i.e. a piece of code that, when run, has no effects
> that are directly observable (or effects that aren't supposed to be
> observed), and defines one or several procedures that need to be
> called in order to achieve the purpose of the code. (That's an
> awkward and probably formally incorrect way to put it, but I hope you
> get my drift.) Consequently, while I agree with many aspects of the
> original formal comment, this particular argument doesn't cut much ice
> with me.

So a Scheme program could in principle consist only of the name of a library
to be invoked. How to supply this name might be implementation-dependent. The
name could, for example, be a compiler argument.

In a system that works this way, Scheme /programs/ can already be written
independently of whether scripts exist in the specification or not.
The language in the report seems to be a little unsure whether "programs are
scripts" or not. For the above reason, if the following is to be interpreted as
"programs are scripts", then maybe it goes too far.

   "A Scheme program is invoked via a script. Like a library,
    a script contains declarations, definitions and expressions,
    but specifies an entry point for execution. Thus, a script
    defines, via the transitive closure of the libraries it imports,
    a Scheme program."

   "A script specifies an entry point for defining and running
    a Scheme program."

> I'm actually sympathetic to wishes to resurrect something like the
> R5RS toplevel, but, having used many different Scheme implementations
> (and trying to teach with some of them), I can't say that the R5RS
> specification did enough to actually give the casual user or novice to
> really get started.

Aren't scripts already toplevels? If they are, then toplevels are
already clearly defined by r6rs (I would just remove the header). But maybe
you are referring to REPL semantics. Unfortunately, no REPL can reproduce
script semantics, due to the two-pass expansion algorithm of scripts. I would
not argue in favour of defining REPLs for r6rs.

Cheers
Andre
Received on Tue Oct 31 2006 - 11:22:40 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC