As for debugging. I do not imagine why anyone will use full debugger for the notebook, but some debugging would be nice, so here is a kotlinish-notbookish solution:
• Introduce a wrapper interface
DebugContext
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.