[CM] Optimiser fault

chohag at jtan.com chohag at jtan.com
Sun Mar 15 10:19:52 PDT 2026


At least it looks like the optimiser because one format function
is getting an argument from the previous call to a format function.

I've golfed this as far as I can and when FAIL is set to #t foo
prints 42 as "thing". If the object->string doesn't call format
(FAIL is #f) or the call to format has 3 or more arguments (bar)
then the output is as expected.

The fault doesn't occur if 'thing is replaced by a string, number
or boolean but does if it's a variable lookup containing one of
those things.

This fails on today's code (S7_DATE "15-Mar-2026") and the version
from before whatever was done to the optimiser last week (S7_DATE
"2-Mar-2026"), so it was't caused by that.

Matthew


(define FAIL #t)

(define (foo LET)
        (format #t "test foo ~A..~A\n" LET 42))

(define (bar LET)
        (format #t "test bar ~A..~A..~A\n" LET 'answer 42))

(define O (openlet (inlet
        object->string: (if FAIL
                (lambda x (format #f "#<~A>" 'thing))
                (lambda x "#<thing>")))))

(foo O)

(bar O)


More information about the Cmdist mailing list