[racket] Contracts error message
Thank you for your thought, Dan. Here are some of mine in return.
I would say that there are several separate things going on here and we'd
benefit from separating them in our discussion. As I understand them,
contract violations are separate from stack traces. A contract violation is
the discovery that something gone wrong in a specific program state (which
is what essentially all of the fields in the OP's message show). A stack
trace tries to reconstruct something about the context of that call in the
underlying VM and is subject to the vagaries of things happening in
Racket's optimizer. You can get stacktraces at any point in a Racket
program [1] and they are useful for other kinds of debugging than just from
figuring out when an error occurred.
Anyway, here's my attempt to reconstruct from the error message, a program
that behaves like the OP, but run with our better stack printing mechanism
(errortrace, it's called) turned on.