[pypy-dev] Paul Fernhout wants edit-and-continue in python

Luke Kenneth Casson Leighton lkcl at lkcl.net
Mon Apr 2 13:58:09 CEST 2007


integration with leo - http://leo.sf.net - would be a good start.

that would give you the GUI part, and context-sensitive execution.

you _might_ have to do something similar to what gcc currently
do, which is to hook in to eevvvveerryyything via __blahblah__
functions, for memory access eevveryyyything, in the "profiling".

but that shouldn't be too hard (but would result in a performance
hit - oh well, can't have everything).

execution itself (from leo) could be performed via "yield".

ok.  you can obtain a list of all variables (global etc.)
that a particular function modifies, right?

so, before you go into any function, right, you record the
previous "state".

in fact, you might be able to record "state" on a per-line
basis (bit extreme i know) and basically have an "undo" stack


yeh.  it's very simple.   look up how "undo" is implemented,
in editors, and then treat all variables like that.

then, you can keep a record (using Leo) of which lines were
modified, and use that to calculate which bits need JIT
recompilation and how far back the "undo" stack you need to
roll.

in _fact_, and this is going to _really_ blow you away, Leo
probably already _has_ an "Undo" capability - and so if you
mentally turn things round, by treating "execute 1 function"
as an "edit" operation under Leo, then you get what you want,
for free!!!

ooooo :)

of course, if any variables are "volatile" - e.g. in an OS,
like cleese, then you're shafted - but that's another story.
and, of course, if anything calls out to _non_ python code,
then you're equally shafted.

in both cases, you can simply throw an exception saying "sorry,
you need to run this program from scratch, dude".




you stand a better chance of doing this in pypy than the python
developers do.

they consider it "impossible", because it's too radical
a rethink, because they have been trapped, by design, in c-code.

l.

p.s. leo is in python, in case you hadn't guessed.




More information about the Pypy-dev mailing list