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

R. Kent Dybvig dyb
Mon Oct 4 12:01:08 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.

Kent


More information about the R6RS mailing list