altavir
11/05/2020, 6:41 AMDebugContext
like this:
interface DebugContext{
fun <T> trace(value: T): ReadWriteProperty<Any?, T>
(suspend) fun breakPoint()
}
• The idea is that you can wrap any variable in the context in a delegate and dump all changes to a debug container. When the breakPoint
is called, the execution will block/suspend and dump current debug state to console/output widget and wait for user input to unblock.
This could be implemented on a library level based on the notebook API. The usage will look like this:
%%debug
var a by trace(4)
repeat(10){
a++
breakPoint()
}
If you like this idea, I can write an issue from it. I personally prefere not to do complex code in the notebook and move all heavy logic to the project.Ilya Muradyan
11/05/2020, 12:12 PMaltavir
11/05/2020, 12:22 PM