← Back to context

Comment by jules

13 years ago

This is great, however it glosses over the elephant in the room: what if a function is called multiple times, or what happens when code within a function is run multiple times? Which data do you display in the data flow view? What is really needed is an intuitive way to select a context or multiple contexts.

SubText's approach to this is to let you dig deeper in the call tree by clicking on function calls, but for a language like Clojure you also need a way to select a context for a piece of code nested within a function. For example suppose you have

    (map (fn [x]
           ...
           ...)
         xs)

You need an intuitive way to display or select a context for the fn.

There are several options here:

- show multiple iterations in place - show a single iteration with a forward and back - show multiple blocks for some reasonable n iterations - ...

I definitely don't think that's going to be an issue longer term and I think there are lots of potential avenues to play around with :)

  • You could just sample and show an example - that's good enough for many uses.

    • I like the previous/next idea -- for me, it's often much easier to understand what a chunk of code does when you can see its behavior on multiple inputs.

And recursion. Light table's display is like a stacktrace, but each line expanded to the whole function. These scaling problems can be solved: exclude some functions, esp libraries (e.g. "native" functions like map aren't expanded). And standard scaling tricks e.g. one line, click to expand (like his doc navigator).

By "context", you mean you nominate a deeper function to display, but then how do you know which call to it is displayed? I think the answer is to display the rest of it, but collapsed/summarized. hmmm, the call trace is a tree in general, so that's getting a little hairier to manage. (NOTE: a tree, assuming you display a fresh instance of a function for each invocation, which you need to do to show the correct variable values)