Python from Wise Guy's Viewpoint
costanza at web.de
Thu Oct 23 17:53:40 CEST 2003
Remi Vanicat wrote:
> Pascal Costanza <costanza at web.de> writes:
>>Remi Vanicat wrote:
>>>Pascal Costanza <costanza at web.de> writes:
>>>>In a statically typed language, when I write a test case that calls a
>>>>specific method, I need to write at least one class that implements at
>>>>least that method, otherwise the code won't compile.
>>>Not in ocaml.
>>>ocaml is statically typed.
>>How does ocaml make sure that you don't get a message-not-understood
>>exception at runtime then?
> It make the verification when you call the test. I explain :
> you could define :
> let f x = x #foo
> which is a function taking an object x and calling its method
> foo, even if there is no class having such a method.
> When sometime latter you do a :
> f bar
> then, and only then the compiler verify that the bar object have a foo
Doesn't this mean that the occurence of such compile-time errors is only
delayed, in the sense that when the test suite grows the compiler starts
to issue type errors?
Anyway, that's an interesting case that I haven't known about before.
Pascal Costanza University of Bonn
mailto:costanza at web.de Institute of Computer Science III
http://www.pascalcostanza.de Römerstr. 164, D-53117 Bonn (Germany)
More information about the Python-list