Python from Wise Guy's Viewpoint
Pascal Costanza
costanza at web.de
Wed Oct 29 09:38:43 EST 2003
Fergus Henderson wrote:
> Pascal Costanza <costanza at web.de> writes:
>
>
>>Can you show me an example of a program that does't make sense anymore
>>when you strip off the static type information?
>
>
> Here's a C++ example:
>
> x << y
>
> Depending on the types of x and y, this might mean left shift, I/O,
> or something entirely different.
And depending on the runtime types, this can be correctly dispatched at
runtime.
> Here's another C++ example:
>
> #include "foo.h"
> main() {
> auto Foo x; // constructor has side-effects
> }
>
> If you strip away the static type information here, i.e. change "auto Foo x;"
> to just "auto x;", then there's no way to know which constructor to call!
But that's not type information, that's just a messy way to implicitly
call a function. (C++ confuses types and classes here.)
Pascal
--
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
mailing list