Typing (Was: Novel Thoughts on Scripting and Languages)
mwm at mired.org
Fri Jan 10 16:11:32 CET 2003
judoscript at hotmail.com (James Huang) writes:
> > Python is dynamically typed, strongly typed, supports multiple
> > inheritance, allows user-classed to redefine how they work with
> > operators like +, -, *, , etc., allows a mixed OO and
> > declarative programming style, has a highly dynamic runtime
> > where I can even change an object's class on the fly, and
> If you can change the class on the fly, does this break the
> strong-typedness? It's sort like (void*). JudoScript does the same
> thing, because an object, after all, is a map with a list of
> associated methods/functions; unless, of course, it is a Java object
> or ActiveX.
No, this doesn't break the strong typing, because of the way python
handles typing. The concern when you are dealing with an objects isn't
"Is this object of a specific type/class", it's "Does this object
support specific operations/methods." Changing the class of an object
on the fly changes the former, but not the latter.
> It's the statical typing that make strong-typedness a big help for
> boosting software quality -- the compiler! And that's what makes me
> wonder people implement big software without the help of compilers.
Actually, static typing doesn't do anything for software
quality. Strong typing does. Static typing helps improve performance,
because the compiler can assume that a variable is of a givent type,
and hence not have to check the type at run-time. This is important
enough that some Lisp compilers let you declare the type, and that
people have built tools to infer the type of variables from the
context for the compiler.
Mike Meyer <mwm at mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
More information about the Python-list