If this would be easy to add to DrRacket, it might be worthwhile...

When you mouseover syntax for a toplevel identifier, a tooltip-like transient display can sometimes show the value. (By sometimes, I mean, perhaps, when either there is a run in progress, or a run has completed and the value is still available and not somehow believed to be "out of date".)

This is some limited variable debugging, without having to run a debugger. I suspect it's most useful when using DrRacket as a fancy script/worksheet calculator.

Latest scenario in which I've wanted this: I'm doing my complicated tax returns in DrRacket (for better traceability of data/decisions/dependencies than the forms permit), and it would be convenient to be able to see the derived/calculated values in the source code view.

For example, in code below, I would like to be able to mouseover `irs-schedule-b-required?` to see the answer, and if it's true, then I might want to quickly mouseover the other identifiers, to see why:

(define irs-schedule-b-required?
(or irs-schedule-b-question-have-over-1500-of-taxable-interest-or-ordinary-dividends
irs-schedule-b-question-received-interest-from-seller-financed-mortage-and-buyer-used-property-as-personal-residence
irs-schedule-b-question-reporting-oid-in-amount-less-than-amount-shown-on-form-1099oid
irs-schedule-b-question-reducing-interest-income-on-a-bond-by-amount-of-amortizable-bond-premium
irs-schedule-b-question-claming-exclusion-of-interest-from-series-ee-or-i-us-savings-bonds-issues-after-1989
irs-schedule-b-question-received-intrest-or-ordinary-dividends-as-a-nominee
irs-schedule-b-question-had-financial-interest-in-or-signature-authority-over-financial-account-in-foreign-country
irs-schedule-b-question-received-a-distribution-from-or-were-grantor-of-or-transferor-to-a-foreign-trust))

For now, I'm doing `define/log` for all the toplevel calculations, which works well enough for my immediate needs, but I think that the DrRacket feature I suggested would have more general usefulness.

(define-syntax define/log
  (syntax-rules ()
    ((_ ID VAL)
     (begin (define ID VAL)
            (log-taxes-debug "(define ~A ~S)" (quote ID) ID)))))

An alternative idea I had was to have an option for DrRacket programmatically modify the source code after a run, to insert comments for calculated toplevel bindings (that are not void, procedures, etc.) on the next line, such as:

    ;;==> #false

That could be a crazy but useful kludge sometimes, but the mouseover idea is more idiomatic of DrRacket, and mouseover could be enabled all the time for everyone.

Neil V.

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to