Mariano Guerra09/14/2018, 9:05 AM
Vladimir Gordeev09/14/2018, 9:14 AM
Mariano Guerra09/14/2018, 9:39 AM
Vladimir Gordeev09/14/2018, 9:47 AM
Mariano Guerra09/14/2018, 9:51 AM
Vladimir Gordeev09/14/2018, 9:53 AM
Mariano Guerra09/14/2018, 10:02 AM
Newspeak is a new programming language in the tradition of Self and Smalltalk. Newspeak is highly dynamic and reflective - but designed to support modularity and security. It supports both object-oriented and functional programming. Like Self, Newspeak is message-based; all names are dynamically bound. However, like Smalltalk, Newspeak uses classes rather than prototypes. As in Beta, classes may nest. Because class names are late bound, all classes are virtual, every class can act as a mixin, and class hierarchy inheritance falls out automatically. Top level classes are essentially self contained parametric namespaces, and serve to define component style modules, which naturally define sandboxes in an object-capability style.
Vladimir Gordeev09/14/2018, 10:10 AM
Mariano Guerra09/14/2018, 10:22 AM
Vladimir Gordeev09/14/2018, 10:24 AM
Mariano Guerra09/14/2018, 11:39 AM
Vladimir Gordeev09/14/2018, 12:05 PM
shalabh09/14/2018, 6:03 PM
This will affect all references to
import moduleA moduleA.moduleB = myModuleB
from within moduleA (but not all cases, only explicit global lookups of ModuleB). You can also pass modules around as objects. Are you thinking about something similar?
Mariano Guerra09/14/2018, 6:17 PM
shalabh09/14/2018, 6:25 PM
and it will change for all modules that reference moduleB (because the runtime lookup goes through that dict). Monkey patching is powerful (and make mocking etc very easy) but the issue is doing it in a controlled, transactional way.
sys.modules['moduleB'] = newModuleB