Squeak-dev Digest, Vol 22, Issue 20
Andreas Raab
andreas.raab at gmx.de
Sat Oct 16 00:00:07 UTC 2004
>> There are things about static type checking that I miss when
>> programming in dynamically typed languages, for example warnings about
>> missing methods, indeed there are things that I'm glad to get rid of
>> too.
> How would you detect a missing method in a dynamic system? Aside from
> the trivial case of there being no method at all of the appropriate name
> (which Smalltalks detect already) what would you do?
Well, this is where it gets interesting and why I think we need a static
type system in Squeak. What happens when you have a static type system in a
dynamic environment is that suddenly you need to deal with "compiler errors"
(such as: selector X isn't implemented in type Y) in an incremental way,
e.g., treat is as a bug. So, for example, the type system would add a bug
report to the class saying "this class sends selector X to type Y which Y
doesn't understand" and it would add a bug report to type Y saying "class
Foo expects Y to implement selector X".
When you'd look at your class in a browser you'd see that there are pending
bug reports and -depending on how you want to go about it- you might either
fix the sender or the type to do the right thing. Once you start going down
that road you could do further things like spending a few cycles in the back
ground on doing more complex type or unit tests and attach appropriate bug
reports to the places affected.
And suddenly, the whole type system becomes a meta-layer for expressing some
of the relationships between classes throughout the system and that can be
useful for many different areas.
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|