Mariano Guerra
Vladimir Gordeev
09/14/2018, 9:14 AMMariano Guerra
Vladimir Gordeev
09/14/2018, 9:47 AMMariano Guerra
Vladimir Gordeev
09/14/2018, 9:53 AMMariano Guerra
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 Gordeev
09/14/2018, 10:10 AMMariano Guerra
Vladimir Gordeev
09/14/2018, 10:24 AMVladimir Gordeev
09/14/2018, 12:05 PMshalabh
09/14/2018, 6:03 PMimport moduleA
moduleA.moduleB = myModuleB
This will affect all references to ModuleB.foo
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 Guerra
shalabh
09/14/2018, 6:25 PMsys.modules['moduleB'] = newModuleB
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.