> Also.. if I understand you right, there are cases when Gambit with auto-forcing enabled also would fail evaluating (abs (delay 0)) .
With --enable-auto-forcing, this case works only when abs is not inlined, in other words an actual function call to abs is performed (because the library definition correctly forces the argument). This can be achieved in various ways, like (declare (not run-time-bindings abs)) or (declare (standard-bindings) (not inline-primitives abs)).
This needs to be fixed so that those declarations, which typically improve execution speed, can be used reliably in a system built with --enable-auto-forcing.
Also, when using the default (declare (safe)) the compiler converts (car lst) into
(if (##pair? lst) (##car lst) (car lst))
rather than the correct
(let ((lst (##force lst)))
(if (##pair? lst) (##car lst) (car lst)))
> > Would it be possible for me to disable this particular aspect of the auto-forcing, to get higher performance?
>
> Currently auto-forcing only works in interpreted code. So if your program does (f x) and (car y) and you compile that, then “f” will not be forced and “y” will not be forced if car is inlined, for example if you (declare (not safe)). You can consider this a bug… to be fixed.
Actually this is not quite true… f will be forced in the call (f x)
thanks to this definition in lib/_kernel.scm:
(define-prim (##apply-with-procedure-check oper args)
(##declare (not interrupts-enabled))
(macro-force-vars (oper)
(if (##procedure? oper)
(##apply oper args)
(##raise-nonprocedure-operator-exception oper args #f #f))))