git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pre-edit stuff persists in a reloaded a module


On 10/5/2019 10:49 AM, Dennis Lee Bieber wrote:
> On Sat, 5 Oct 2019 16:24:14 +0200, Friedrich Rentsch
> <anthra.norell at bluewin.ch> declaimed the following:
> 
> 
>> Thank you, Peter. I guess, then, that not only 'inspect', but the
>> compiler as well reads source off the line cache and clearing the latter
>> would make 'reload' work as expected. Are there other snags lurking,
>> that you advise against using 'reload'? What are the alternatives for
>> developing iteratively, alternating between running and editing?
>>
> 
> 	The simplest is to open a separate shell/console for running, and save
> from the editor before doing each run.
> 
> 	Or try something other than IDLE, though pretty much any IDE that
> provides interactive access could fall a foul of this problem (the
> execute-in-separate console means a clean interpreter for each run;

Actually running from the IDLE editor, as opposed to reloading in the 
shell, gives a clean interpreter, in a new subprocess, for each run. 
Plus it has some advantages over separated editor and console REPL.  The 
first is that it compile()s the code to check syntax before starting the 
subprocess. If there is an error, IDLE highlights the error location and 
puts the cursor there so one can correct it.  The last, which I 
mentioned in response to Friedrich, is the ability to jump back to the 
location of runtime exceptions.

-- 
Terry Jan Reedy