[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dynamic vs. static typing




> From: "Peter van Rooijen" <ll1@vanrooijen.com>
> Date: Wed, 26 Nov 2003 10:32:34 +0100
>
> [Note: Sometimes the information I cannot express, but would like to (and
> would like to have checked for consistency), is about the types of variables
> or functions. This is especially the case when the type is a basic one, such
> as integer, number, or boolean. More often, the information is about the
> type of operations (which imply their semantics). I've never seen a language
> that allows me to specify that. Anyone?]
> 
> Cheers,
> 
> Peter
> 

I recall something Alan Kay once wrote, saying that a possibly useful
addition to Smalltalk might be a way of checking "protocols" in advance
(I'm paraphrasing).  In other words, it would be nice to check that a given
object which is an argument to a method supports a particular protocol (set
of messages it can respond to) regardless of what the specific class of the
object is.  This sounds great in principle, but in Smalltalk, at least, I
can see problems because it's possible to alter the protocol of a class at
any time by deleting methods.  But if you could annotate classes with a set
of messages that they guaranteed that they supported (i.e. a protocol),
perhaps it could be done.  This reminds me of the interface concept in
java, which has proven to be amazingly useful in that language.  Have any
dynamic typing enthusiasts thought of adding such a feature to their
languages?

Mike