4 ms·
Right - but you can observe the differences reliably without a clock, through looking at the stack trace.
by chrisseaton 6y ago
Right - but you can observe the differences reliably without a clock, through looking at the stack trace.
- eru 6y agoThat's (a small) part of the reason why Haskell didn't have stack traces for the longest time.
- beagle3 6y agoOr even more simply, by blowing up the stack. If you manage to do 2^40 calls deep without blowing up the stack, you have TCE, if you do blow up the stack, you don't. And you can tell if you blew up the stack by setting up an exception handler (or lisp condition or whatever equivalent).
- chriswarbo 6y ago> you can tell if you blew up the stack by setting up an exception handler (or lisp condition or whatever equivalent). That only works if there's some way to tell whether the stack blew up (as you say: catching exceptions, lisp conditions, or whatever equivalent). I'd put those language features in the 'messy' category: useful on occasion; not used by most code; makes all code harder to reason about (hence the subjective "reasonably-unobservable" category above)
- chriswarbo 6y agoClocks and timing were one example. I generalised to these other cases when I said: > I'd probably count inspecting stack traces, or running a debugger on ourselves, in this category. I would put such things in the "unreliable" category, since it's the sort of thing that may vary between compilers (including future versions), and may depend on internal details of dependencies which are subject to change. I certainly wouldn't let them through code review; it can be hard trying to understand 'foo(bar)' in terms of 'the function "foo" applied to the input "bar"', I'd rather avoid the extra complications of having to think about 'pushing a fresh stack frame, clearing registers A, setting the instruction pointer to B, adding C instructions to the ALU's adder pipeline, forcing a flush of D cache lines, ...'