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

Re: dynamic vs. static typing

On Nov 26, 2003, at 11:10 AM, Michael Vanier wrote:
> 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?

Objective-C supports this but it's almost never used. Class typing is 
generally used instead, which is unfortunate.

-- Steve