Questions about app design - OOP with python classes
John Nagle
nagle at animats.com
Sun Mar 4 01:50:06 EST 2007
Steven D'Aprano wrote:
> On Fri, 02 Mar 2007 09:30:20 +0100, Diez B. Roggisch wrote:
>
>
>>>A type system doesn't help. So what if they're both floats? The test
>>>is still bogus, your code will still wait too long to engage the
>>>retro-rockets, and the billion dollar space craft will still be travelling
>>>at hundreds of miles an hour when it reaches the surface of Mars.
>>
>>A type system _could_ help.
>
>
> It's easy to wave your hands and say that Microsoft could have done
> something different, but they had to work with what they had, not some
> hypothetical alternative language with a hypothetical type system that
> didn't exist then (if it even exists now).
The Pascal/Ada/Modula family of languages all had type systems
with restrictions on conversion. Unlike C, types in Pascal
are not simply abbreviations of the type; they're unique types.
This turns out to be too restrictive, but it's certainly been
tried.
There are C++ class libraries that understand units. And
the conversion factors can be dealt with at compile time, so
the overhead goes away.
John Nagle
More information about the Python-list
mailing list