Shane Caraveo from ActiveState wrote me a note illustrating how they handle WSDL for Perl:
=for interface
static ustring echostring(ustring something);
sub echostring { my $echo = shift; return $echo; }
The question is overhead. Obviously this metadata, like all documentation, requires double maintenance, and can get out of synch with the code. As a Perl programmer, would I rather pay that cost in the form of typing all my functions and variables, and have a free ride on WSDL generation, or pay it only on a per-exported-object basis?
Sam Ruby and I talked about this today. He makes a good point: since exported stuff will surely be a fraction of all the stuff you write in a dynamic scripting language, why not just pay on an as-needed basis? It's an 80/20 (or 90/10) thing.
The flip side of this is that web services network effects arise, I believe, when things can automatically, or almost automatically, be exported -- even when the need to do so wasn't originally anticipated.
Kevin Altis, who is working these days on PythonCard, sent me this set of definitions which was in turn sent to him by "an erudite reader":
"statically typed language
A language in which types are fixed at compile time. Most statically typed languages enforce this by requiring you to declare all variables with their datatypes before using them. Java and C are statically typed languages.
dynamically typed language
A language in which types are discovered at execution time; the opposite of statically typed. VBScript and Python are dynamically typed, because they figure out what type a variable is when you first assign it a value.
strongly typed language
A language in which types are always enforced. Java and Python are strongly typed. If you have an integer, you can't treat it like a string without explicitly converting it (more on how to do this later in this chapter).
weakly typed language
A language in which types may be ignored; the opposite of strongly typed. VBScript is weakly typed. In VBScript, you can concatenate the string '12' and the integer 3 to get the string '123', then treat that as the integer 123, all without any explicit conversion.
So Python is both dynamically typed (because it doesn't use explicit datatype declarations) and strongly typed (because once a variable has a datatype, it actually matters)."
(If you are that "erudite reader" and wish to be identified, just let me know.)
Correction: here is the source of this quotation: it's from Mark Pilgrim's fabulous online Python book-in-progress. Sorry for the mixup, Kevin and Mark.
Note: it's tempting to try to rewrite history by changing these entries on the fly in order to erase errors. But that won't last forever. Before too long, the Wayback Machine will catch you in the act when you try to cover your tracks :-)
Perhaps this explains why I have the sense that if optional type declaration were going happen in any major scripting environment, it would happen first in Python.
4:12:23 PM
|