Are there any more details/documentation for instrumentation (Count statements executed, step through the flow of execution, retrieve past variable states). I’m really interested on the features, and things like Brett Victor’s Inventing on Principle Video
I don’t have good docs for how to use those features, given that they’re a bit wonky and experimental (I keep changing the API around, since there are no other consumers other than CodeCombat). I could explain it, though; the features can be pretty cool. I’m pretty short on time at the moment caring for a newborn, but maybe I can answer some specific questions about it if you can give me some more info on your use case?
Hello Nick! I’m really interested in the features mentioned in the Instrumentation part. It’d be great if there are examples for them:
- Count statements executed,
- step through the flow of execution,
- retrieve past variable states
- pause and resume execution whenever you want
Thanks! I think these features are really interesting, and would be very useful for this ‘toy’ I’m building
After you run a program that Aether has instrumented (most of this stuff is on by default), you can inspect the
aether instance to access its
flow properties, which should contain statements executed and the number of times each statement (indexed by ranges into the source code) was executed.
You can also step forward/back by reading the
flow property. Though it gets really expensive because it’s implemented stupidly, it can also capture local variable values after each statement, which is also in the
flow property. This lets you do things like show variable values on hover when stepping backward and forward. For larger programs, you have to turn that off and do it more intelligently by rerunning the program to the point the user’s interested in (or hack on Aether to make it more efficient at capturing values).
Check out the Aether demo page. You can add
console.log(aether.flow) to the end of the top middle code editor, since the bottom right flow analysis pane isn’t working right now. You can then see how the flow is stored:
Hope this helps!