Fully dynamic d by opDotExp overloading

Christopher Wright dhasenan at gmail.com
Sat Apr 18 05:55:02 PDT 2009


Nick Sabalausky wrote:
> "Christopher Wright" <dhasenan at gmail.com> wrote in message 
> news:gsb05g$2ini$3 at digitalmars.com...
>> 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.
> 
> I don't think I understand what you're trying to say. With static languages, 
> I have never written, nor would I ever need to write, a test that checks for 
> the behavior when accessing an object's "legnth" instead of "length". 

And let's say your object suddenly gets a "legnth" field because it's 
from a library and you start using a newer version of the library. 
Either that field does the same thing -- in which case it's not a bug to 
use the wrong one -- or it does something different, in which case your 
code has a logic error caused by a typo.

Testing the logic of your code will catch the latter error and not the 
former. But the former isn't an error, if it has the same result.



More information about the Digitalmars-d mailing list