[Vm-dev] Recreating live coding in CPython 3.5

Dimitris Chloupis kilon.alios at gmail.com
Sat Oct 14 14:46:20 UTC 2017


Thanks Berhard

I managed to accomplish a full live coding environment in Python and I am
now in the process turning this to a library, to automate all the steps
required.

It was with your help I realized my mistakes , especially that post that
pointed me to the python implementation of become, guided me towards the
solution

My conclusion at least from a user perspective that Python is already a
live coding environment, that someone has turned off.

So in order for old instances to be updated there is no need to mess with
their objects and hence no need to implement a become functionality. Python
allows to change the methods of an old instance with methods of a new
updated instances. However this is no solution because other old instances
of same class are not updated.

Not to bore you with technical details but the actual solution is to access
the references to old classes and update their methods to the methods of
the new classes. If that happens automagically all old instances get the
new methods and there is no reason for extra steps.

This workflow work before compilation, after compilation and of course the
most important during execution. Essentially this accomplishes live coding
going the opposite direction of become. It applies for any kind of Repl and
any kind of debugger. I have tried python repl and python debugger as well
as iPython repl and iPython debugger. No problem so far.

This works also for superclasses and subclasses because Python uses
Singleton references wherever it can unless of course instructed otherwise
by the coder. So I don’t have to worry about inheritance issues.

I am a bit worried about creating dangling references but this would
require some stress testing to inspect how well the garbage collector works
but I don’t expect major issues because I am generating new objects with
empty state while old state is retained in its place. Of course state can
be manipulated lively through live coding as one would expect.

I don’t see any other problem and what is left now is to gather all my
tests under a single library. The library will detect when a source file
got modified and follow the above workflow.

I would like to thank you all for your assistance I am very happy that
accomplished this goal.
On Sat, 14 Oct 2017 at 15:29, Bernhard Pieber <bernhard at pieber.com> wrote:

>
> Hi Dimitris,
>
> This conference article might be relevant:
>
> https://2017.programming-conference.org/event/morevms-2017-papers-when-a-mouse-eats-a-python-smalltalk-style-development-for-python-and-ruby
>
> Cheers,
> Bernhard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20171014/8186faf7/attachment.html>


More information about the Vm-dev mailing list