kilon.alios wrote > Care to explain what difficulty you experienced in live coding with > Python. > Or what Pharo can do that Python can’t live code wise ? Maybe I will learn > something.
It's funny that one of main reasons why I discovered and started using Pharo was failure to get live coding working for Python (Jython in particular). And now time after time kilon.alios states that live coding in Python is "easy" and no big deal. I will tell you, Pharoers, about code reloading in Python, and let you decide for yourselves how it compares to Pharo. Out of the box in Python you can execute some Python code and reload modules with reload() function. What reload() does is it reads code from file (in Python each source file corresponds to module), executes it, and replaces reference to [that module] in current module. >From that moment, any code in current module, when referencing reloaded module, will point to new version of it. All implicitly imported names will (like from foo import bar, from foo import *, etc.) will point to old version. Also all other modules except current will not be affected. There are, however, third-party libraries, that take care of it. But that's not all. All instances and subclasses of old classes will point to old versions of classes. To counter that, instead of replacing old module you could replace its contents by newer variables/functions and patch classes by replacing their contents. Some third-party libraries do that. That's still not all. If you store references to functions/methods/classes, that references will point to old versions. reimport library takes care of that, but it uses implementation-specific feature of CPython's GC, which lets you get all references to some object. Unfortunately, it doesn't work in Jython, and probably in other alternative Python implementations. But wait, what if you rename a class or function, or change its base class(-es)? You're out of luck. Theoretically you could handle such change if recent code change consists of a single rename, but that's it. I may have missed some other edge cases and haven't talked about tools support, but I hope you get the idea. -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html