[
Lists Home |
Date Index |
Thread Index
]
[Richard Tobin]
>Java has typed variables, Python doesn't.
But in Python, everything is an object and has a type as a consequence of that.
In the expression:
x = 1 + 2
there are three objects, each of which has a type.
[...]
>As I think Guido pointed out, static typing only catches a fraction of
>even the simple non-algorithmic errors you can have. It doesn't help
>that you type-checked an integer assignment if the LHS is in inches
>and the RHS is in centimetres. It doesn't stop you getting arguments
>in the wrong order unless they happen to be of different types.
>And the incredible verbosity of common constructs like iteration in
>Java is largely due to static typing, and is a source of errors just
>by ensuring that your method doesn't fit on the screen.
Absolutely!
The same is true (oh so true!) in XML where developers lull themselves
into thinking that because they have nailed down every last date, every
last floating point number that they have "caught" at XML construction
time, all the data structure errors. All the interesting errors are as David
Megginson noted, further up.
An important difference between the XML case and the programming
language case I think is that XML is much more likely to be the
subject of a contextual interpretation.
With Python *text* I can treat it as UnicodeWithTokens or as a data structure
or as instructions to a virtual machine. That's about it.
With XML, basically every single encounter with a process is a new context,
subject
to local interpretation of the XML. In this situation, any static typing added
to the XML in a way that forces you into a particular context is
counter-productive.
You end up fighting against it in your code. It works against you, not with
you.
Thats basically how I have always felt about static typing - it works
against me, not
with me and its benefits are dreadfully over estimated out there. Both in
programming
languages and in XML.
Of course, those out there who see XML as just a convenient serialisation
syntax
for objects won't see the point of all this. In that closed world, all the
type coercion
issues occur further up the chain - in their programming language of choice.
regards,
Sean
http://seanmcgrath.blogspot.com
|