[r6rs-discuss] [Formal] Allow compilers to reject obvious
pfr6rs at pnkfx.org
Sun Feb 25 04:24:53 EST 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." 
Larceny v0.93 "Deviated Prevert" (Nov 10 2006 04:27:45, precise:BSD
> (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.
More information about the r6rs-discuss