[r6rs-discuss] [Formal] Allow compilers to reject obvious violations

From: <bear>
Date: Sun Mar 11 13:15:27 2007

On Sun, 25 Feb 2007, William D Clinger wrote:

> The language described by the draft R6RS cannot be
> implemented by a pure interpreter (*). Lexical checking,
> macro expansion, syntax checking, bound-variable checking,
> and immutability checks are required before any part of a
> program can begin its execution.

Because scheme is a language that has 'eval', it will *always* be
possible to construct a list during a run and 'eval' that list.

Thus it will *always* be possible to have syntax errors that are not
detected until runtime.

I believe that the standard should encourage implementations to find
errors as early as possible, but I do not think it is reasonable to
require *all* of any type of error to be detected before runtime.

Furthermore, I think that incremental compilation is a reasonable
implementation approach (with advantages such as reduced latency and
incremental development). In an incremental compiler, one would read
code as list structure and then do nothing more with it at all until
the demand for execution of that code is actually made. Why should
code be macroexpanded if it's not actually going to be called in a
given run? Why should code be generated if it's not going to be run?
Why should the effort of optimization and type proving and typecheck
removal and so on be made if it's not going to be run enough times to
pay back that effort?

Purely as a matter of not wasting computational resources, I think the
standard should preserve the right of an implementation in the
ordinary case to interleave the compilation process with runtime, and
consequently give the system the right to *NOT* detect errors until
runtime.

This would mean that guarantees about what happens at "macroexpansion
time", "compilation time", etc, ought to be relative to individual
procedures and code regions, not whole programs. We can guarantee
that any particular routine is macroexpanded before it is compiled and
compiled before it is run; But is it really necessary, *IN ALL CASES*,
to guarantee that no macroexpansion or compilation is interleaved with
runtime? I claim that it is not, and that attempting to do so may
unnecessarily constrain both language implementors and developers.

                                Bear
Received on Sun Mar 11 2007 - 13:15:19 UTC

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