Fully dynamic d by opDotExp overloading

bearophile bearophileHUGS at lycos.com
Fri Apr 17 11:34:12 PDT 2009


Nick Sabalausky:
> > There are people who swear by the ability of adding methods at runtime and 
> > changing the inheritance hierarchy dynamically. It makes for a very fluid 
> > environment.
> 
> Personally, I've always seen that as extremely sloppy and haphazard.

Adding methods at runtime is named "monkey patching", and it is considered a bad practice even in Python. In Ruby it is more common.
Usually in such languages such things are less dangerous because the code contains lot of tests anyway.
Some people say that a way to remove most of the downsides of monkey patching is to make it scoped, that is the changes (like a method added or replaced) to a class aren't seen globally in the whole program (like from other modules), but only in the scope where such change is done (and its subscopes). I think I have not seen languages where this is doable yet.

Bye,
bearophile



More information about the Digitalmars-d mailing list