On Wed 18 Jan 2012 23:21, l...@gnu.org (Ludovic Courtès) writes:

> Andy Wingo <wi...@pobox.com> skribis:
>
>> On Wed 18 Jan 2012 22:18, l...@gnu.org (Ludovic Courtès) writes:
>>
>>>         (('apply (f args))
>>>          (apply (eval f env) (eval args env)))
>>
>> This is in primitive-eval (and here, `eval' is locally bound).  Mark is
>> talking about R5RS `eval' (`scm_eval').
>
> OK, but ‘scm_eval’ is not recursive, so no wonder it’s not
> tail-recursive.  :-)
>
> (I’m confident I’m missing something, but I just fail to see what.  ;-))

Hee hee :)  The point is that this should loop indefinitely:

  (define (loop)
    (eval '(loop) (current-module)))
  (loop)

It doesn't, because the function that "eval" resolves to is implemented
in C.  If we implemented it in Scheme, it still wouldn't work, because
it would be like:

  (define (loop)
    (with-fluids ((%%%current-module (current-module)))
      (primitive-eval '(loop))))
  (loop)

and the with-fluids makes it not tail recursive.

Andy
-- 
http://wingolog.org/

Reply via email to