[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dynamic vs. static typing



Anton van Straaten wrote:
> Steve Dekorte:
> 
>>On Nov 24, 2003, at 11:48 PM, Anton van Straaten wrote:
>>
>>>I'm reminded of the argument about wearing helmets on a bicycle or
>>>motorcycle: head injuries actually aren't that high a proportion of the
>>>injuries that occur during accidents, so why wear a helmet?
>>
>>Because the type of accident is worse (broken skulls are less desirable
>>than broken arms). In the case of programming, I don't see how it's any
>>worse to raise a "does not respond" error than to produce the wrong
>>result.
> 
> It's worse because it happens later, including at runtime - keeping in mind
> that unit tests can't guarantee to find a certain class of errors, as type
> checking can.  In addition, even if the unit tests do catch the error, the
> cause may not be as clear, i.e. you find the consequences of the error, not
> the error itself, and have to trace back to figure out the cause.
> 
> A 'does not respond' error is a best case.  A worse case is sending a
> message to the wrong object that appears to be understood - exactly the kind
> of error that can slip through unit tests to manifest at runtime.

It is my understanding that CLOS is a dynamically typed language in 
which this cannot happen because generic functions are globally unique. 
This ensures that if an object "happens" to understand a message then it 
does intentionally so.

Or do you mean something else?


Pascal

-- 
Pascal Costanza               University of Bonn
mailto:costanza@web.de        Institute of Computer Science III
http://www.pascalcostanza.de  Römerstr. 164, D-53117 Bonn (Germany)