-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Time traveling visual debugger #18
Comments
Hey @breandan , I am new to Kotlin and would like to learn more of it. Can i try on this one? Do this project have any slack or discord? |
Hi @therealansh, welcome to the Kotlin community! PRs are certainly welcome. You might have a look at the |
Hey @breandan where should I implement these files? Any specific directory? |
You will need to make changes to the You could add a demo for the debugger to fun main() {
DEBUG = true
val x by DReal.Var()
val y by DReal.Var()
val f = x * (-sin(x * y) + y) * 4
f(x to 0, y to 1) // This should open a browser window with the debugger stack navigable using ←/→ keys
} If you're feeling ambitious, it would be nice to improve the graph visualization algorithm somehow, instead of just displaying the static graph, it would be nice to see edges labeled with values flowing across them (e.g. see the reduction semantics). For that, you may need to modify Kaliningraph's implementation to make Again, feel free to ping me if you have questions about any of this. Thanks! |
Hey @breandan So i have a couple of questions. So as i can see in the fun apply(vararg xs: Fun<X>): SFun<X>{
if(EAGER){stack??.push(toGraph()}
when (op) {
Monad.id -> this
Monad.sin -> (xs[0] as SFun<X>).sin()
Monad.cos -> (xs[0] as SFun<X>).cos()
Monad.tan -> (xs[0] as SFun<X>).tan()
Monad.`-` -> -(xs[0] as SFun<X>)
}
} Similar with the df() recursive call. Here how can we access the debugger stack by getStackTrace() ? or it will be just an empty stack when we initialise the function. Thanks for helping in advance i am new to this big codebase so might take a few days to get along. |
Yep, that’s a good point. We separated the Kweb dependency from the main library to avoid dependency bloat. If you want to use Kweb for your debugger implementation, you can just add a I guess the simplest debugger implementation would just accumulate intermediate graphs in a mutable variable, which could be read asynchronously. If you want to define a custom function |
Debugging Kotlin∇ code within IntelliJ IDEA can be somewhat cumbersome due to the functional API structure (lots of deeply-nested stack traces and context switching). To facilitate more user-friendly debugging, we should add support for visual debugging by exposing Kaliningraph’s built-in graph visualization capabilities. For example, the user could attach a debugger to the computation graph by writing
fn.debug(bindings)
, which would open a browser window and allow them to replay the rewriting steps, see numerical values flowing through the nodes and step forward and backward through time.Alternatively, a better approach might be to reuse Buche, which is specifically designed for visual debugging. In this case, we would simply need to attach to the browser using a background process then write the logs to e.g. standard output. Perhaps it is possible to get Buche to play together with Kotlin/JS somehow, need to investigate this approach further to understand its complexity as compared with Kweb rendering.
The text was updated successfully, but these errors were encountered: