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

From: Felix Klock <pfr6rs>
Date: Sun Feb 25 04:24:57 2007

On Feb 25, 2007, at 4:05 AM, Michael Sperber wrote:

>
> William D Clinger <will_at_ccs.neu.edu> writes:
>
>> Several extant Scheme compilers already perform static
>> analyses that can occasionally establish that some
>> expression would inevitably raise a &violation exception
>> were the expression ever to be executed. The R6RS
>> library system will make it much easier for compilers
>> to detect such violations at compile time.
>
> Could you provide some examples where you consider this useful? I
> know they exist, but it would help me understand your position if I
> knew some examples for problems you're trying to solve.

Here's one I find useful occasionally: doing arity checking ahead of
time. Larceny will do this for "known procedures." [1]

% larceny
Larceny v0.93 "Deviated Prevert" (Nov 10 2006 04:27:45, precise:BSD
Unix:unified)


> (let* ((f (lambda (a b) 3)) (g (lambda () (f 4)))) g)


Error: Wrong number of arguments to known procedure ((begin .f|3) '4)
Entering debugger; type "?" for help.
debug>

[1] http://www.ccs.neu.edu/home/will/Twobit/p2background.html#known
Received on Sun Feb 25 2007 - 04:24:53 UTC

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