dont-tail-calland use it like this:
(dont-tail-call (foo x))The semantics of Scheme are that the arguments are evaluated before the call to the function, so the call to
foois required to occur before the call to
dont-tail-callwhich necessitates allocation of a continuation.
But what about a really clever compiler that somehow “optimizes” away the call to
dont-tail-call? Such an “optimization” is highly questionable because it changes the observable semantics of the program so it is no longer call-by-value. A compiler that performed that transformation wouldn't be a Scheme compiler because Scheme is a call-by-value language.
But what if we had really clever compiler and we disregard the change in semantics? We can easily thwart the compiler by deferring the definition of
dont-tail-calluntil run time. Even the cleverest compiler cannot see into the future.
The definition of
dont-tail-callis left to the reader, as is how to defer it's definition until run time.