Re: Are Dynamic Languages Going to Replace Static Languages?
Posted: May 11, 2003 3:23 PM
> OK but if your change affects the interface or calling
> protocol you still have to find all the callers in either
> case. This is quite feasible in the statically typed
> case, whether you use grep or a fully fledged analysis
> But how would you find the call sites in a dynamicaly
> typed language? For what string would you grep?
Well.... In Squeak (open source smalltalk), if you mistype a message send or variable name, the compiler will sort of "spell check" these symbols and offer you "pretty close" choices during compilation. So typos aren't really a problem and the system helps you fix them (as opposed to, say javac which will just tell you where in the file something isn't quite right.
Second, when removing a method, the system will confirm the removal and tell you how many call sites there are. With a click, the call sites are displayed and you can fix them (or ignore them - sometimes they are sending a message of the same name in unrelated code).
You can always perform a query for "all references of class", "all senders of message", "all implementations of message", and so forth. Because the system is dynamic and alive, you can do any number of queries on the actual code.
Finally, the ability to fix code in the debugger, back up, change code, step forwards, etc... means that my code is better tested under more conditions than any static language code I've ever written. The most robust programs are written in the environment that makes it easiest to find and fix the bugs. Period.
I'll finish by mentioning that I'm about equally fluent in C, C++, Java, Objective C, and Smalltalk. There are plenty of large scale Smalltalk systems around and my experience is that they are much easier to scale than systems of equivalent complexity written in C++.
They just don't seem as large because they were so much easier to write!
> Putting it another way: a static type system, for all the
> effort it requires of the programmer, creates a static
> dependency graph for the program. And this is useful in
> analysis and refactoring.
Refactoring originated in the Smalltalk world I believe - at least we've had the refactoring browser a lot longer than the Java folks.
> But the "find all callers"
> problem represents a very real practical difference that I
> have not seen addressed in the static vs. dynamic
This problem is far easier to solve in Smalltalk than in a static language. With static languages, you're usually stuck with grep.