alexknauth / debug Goto Github PK
View Code? Open in Web Editor NEWa racket lang-extension for debugging, and a macro for inserting a debug-repl
License: Other
a racket lang-extension for debugging, and a macro for inserting a debug-repl
License: Other
There’s a build error on debug
that’s percolating through to my Travis builds that rely on debug
(naturally):
raco pkg install: packages conflict
package: rackunit-typed
package: typed-racket-more
module path: typed/rackunit/type-env-ext
In:
#lang racket
(require debug/repl)
(define x 10)
(define (f x)
(+ x (debug-repl)))
Running (f 10)
results in:
namespace-set-variable-value!: assignment disallowed;
cannot re-define a constant
constant: x
When instrumenting calls to recursive functions, it's hard to tell which calls match which returns.
Showing the value of the arguments in addition to / instead of the instrumented form.
That could be a different form, like #A or something.
The ability to disable debug (or otherwise override debug's behavior) at runtime would be a great feature.
Downside: it might encourage people to start committing code with #R
all over the place. ;-)
Is it possible to use the reader extension with typed racket?
First, this package is awesome!
When using it to debug TR, I sometimes need to print large values. Pretty-printing would make them more readable.
Sometimes I don't want to debug an expression, I want to debug all calls to a particular function. Would that belong in this package or a different library?
I'm imagining something like define/debug
that works just like define
but acts as if all callsites are wrapped in #R
.
The #R
syntax from #lang debug
should be able to be used in the repl as well as in the main file.
Contributors @SuzanneSoy, @mbutterick, @sorawee, and @florence, I would like to add the MIT License to this repository.
If you agree, please post a message saying so, e.g. — "I hereby license my contributions to debug
under the MIT license."
I would like to make the debug
metareader part of the default #lang br
environment (that is, #lang br
would work the way #lang debug br
does now). Roughly, how might I do this with the current debug
interface? Or would it require some form of cooperation not yet available?
Compiling debug
currently fails due to the use of 3D syntax in debug/repl.rkt
. I see the purpose of this, and it does appear to work as long as the code isn’t compiled, but it causes raco setup
errors, which is annoying. I’m not totally sure how to work around it, though, since this sort of intentionally passes a value between phase levels in a way that the compiler can’t understand.
Of course, DrRacket doesn’t need syntax objects reduced to strings, becuase it can produce the nice clickable native display. It’s not hard to patch report
to do this, except for one thing: restricting the behavior to the DrRacket REPL (as opposed to any REPL).
So I think this reduces to the question: Is there a way for a macro to detect whether it’s being invoked within DrRacket?
The following:
#R(+ 1 #R(+ 2 3))
Produces this debug output:
(+ 2 3) = 5
(+ 1 (let () (local-require (only-in debug/report (report report))) (report (+ 2 3)))) = 6
The outer #R captures the macro expansion of the inner #R. This is difficult to read, especially with more complex expressions. Changing this is probably more trouble than it's worth, but it's an interesting problem at least.
#lang racket
(require debug/repl)
(define (test)
(when #t
(debug-repl))
(define a 1)
a)
(test)
Causes the error: a: undefined; cannot use before initialization
Within a (debug-repl)
, I want to the local variables accessible within it to be immutable. By that I mean using set!
on them should fail.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.