Python from Wise Guy's Viewpoint
Remi Vanicat
vanicat+invalid at labri.fr
Thu Oct 23 11:28:38 EDT 2003
More information about the Python-list mailing list
Thu Oct 23 11:28:38 EDT 2003
- Previous message (by thread): Python from Wise Guy's Viewpoint
- Next message (by thread): Python from Wise Guy's Viewpoint
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 method. By the way, It might give you some headache when you have made a spelling error to a method name (because the error is not seen by the compiler where it happen, but latter, where the function using the wrong method is used). -- Rémi Vanicat
- Previous message (by thread): Python from Wise Guy's Viewpoint
- Next message (by thread): Python from Wise Guy's Viewpoint
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list