December 01, 2003
When trying to explain the difference between dynamic typing and weak typing, I used to refer to this page (specifically the Addendum at the bottom). I still will - it's brief, but gets the point across.
For the long version, though, in future I'll refer to What the heck is: A type.
Posted to Software development by Simon Brunning at December 01, 2003 01:48 PM
It's interesting that that second article touts Perl as a *strongly* typed language. I've seen it described as weak before, and not without reason... "12" + 3?
Yeah, I noticed that. But the example he gave seemed to make sense, and I know virtually nothing about Perl, so I just let it slide...
I knew that example would give people fits. However, it is correct. In perl "12" is not string data, nor is 3 integer data -- both are scalars, and all scalars can present an integer, floating point, and string representation of their value. The problem is not that perl is weakly typed (it isn't) rather that people misunderstand perl's type system. This doesn't necessarily make the type system good or bad, but it is still strongly typed. Feel free to take issue with the rich behaviour if its base types if you'd prefer. (Certainly a reasonable argument to make)
It was in there in part to try and get people to think twice about types, as they don't always represent what you think they do, nor behave in ways you think they might.
Hmm, that seems to make sense. Maybe I should study Perl's type system...
Dan, you did indeed make me think twice about types. Thanks. And if you say Perl is strongly typed, then that's good enough for me. As I said, I don't know anything about Perl.
I think I'll stick with Python's more intuitive types, though...