[R6RS] Yet another question (to Matthew I guess)

Manuel Serrano Manuel.Serrano
Tue Oct 5 09:39:03 EDT 2004


> With letrec semantics, the check for foo suffices, since there's no way
> to get to an invalid call to bar without first calling foo.
> 
> With letrec* semantics, there would be a check in foo for bar:
> 
>   [foo (lambda ()
>          (let loop ([n 1000000000000000000000000000000000000000000000])
>            (if (> n 0)   
>                (begin
>                  ((begin
>                     (if (not bar-valid?)
>                         (undefined-variable-error 'bar))
>                     bar)
>                   n)
>                  (loop (- n 1))))))]
> 
> This does not inhibit the optimization (e.g., inlining) of the call to
> bar from foo.  There is a small amount of overhead to do the check, but
> this didn't happen very much in the code we analyzed.  Still, we might
> want to allow these checks to be suppressed in the unsafe mode we've
> talked about standardizing upon.
Yes but the overhead is there. It enlarges the code, it requires more 
registers, it minimizes the effect of control flow and data flow optimization, 
etc, etc.

-- 
Manuel


More information about the R6RS mailing list