News for hackers. Stuff that matters.
Re:Local Variables as Accidental Breadcrumbs for Faster Debu... by lispm on Friday October 11, 2024 @06:17AM (#41808107)
Or even better have the assertion offer a way to repair the problem:

    CL-USER 1 > (defun calculate-something (big small)
                  (assert (>= big small)
                      (big small)           ; these can be reset
                    "Big ~a must be bigger than small ~a" big small)
                  (sqrt (- big small)))
    calculate-something
The error handling will now offer me to repair it, if necessary:

    CL-USER 2 > (calculate-something 4 7)

    Error: Big 4 must be bigger than small 7
      1 (continue) Retry assertion with new values for BIG, SMALL.
      2 (abort) Return to debug level 0.
      3 Restart top-level loop.

    Type :b for backtrace or :c <option number> to proceed.
    Type :bug-form "<subject>" for a bug report template or :? for other options.

    CL-USER 3 : 1 > :c 1 
    The old value of BIG is 4.
    Do you want to supply a new value?  yes

    Enter a form to be evaluated:
    17

    The old value of SMALL is 7.
    Do you want to supply a new value?  yes

    Enter a form to be evaluated:
    5

    3.4641016
The last number is the return value

There are no comments on this comment yet.