Fully dynamic d by opDotExp overloading

Christopher Wright dhasenan at gmail.com
Fri Apr 17 15:34:30 PDT 2009


Nick Sabalausky wrote:
> "bearophile" <bearophileHUGS at lycos.com> wrote in message 
> news:gsai34$1p9k$1 at digitalmars.com...
>> 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.
> 
> Interesting, I didn't know that.
> 
>> Usually in such languages such things are less dangerous because the code 
>> contains lot of tests anyway.
> 
> See, that just sounds to me like the dynamic-ness is just creating extra 
> work for less payoff. I'd rather have my compiler automatically guarantee 
> correctness (when possible) than have to manually create even more tests 
> than I'm already creating and *hope* that they catch all the problems.

Assuming that you are testing the logic of your application, you will 
trivially check things like accessing "legnth" rather than "length" -- 
under the assumption that these two methods would do different things. 
You would spend approximately no additional testing effort on opDotExp.

This doesn't hold if you are not writing tests.



More information about the Digitalmars-d mailing list