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

Re: the forward method [dynamic vs. static typing]




On Nov 20, 2003, at 5:35 PM, Ken Shan wrote:
> I didn't mean to imply that you actually need to implement a 
> respondsToX
> method for every possible method X; I was just trying to simplify the
> exposition (and apparently failing).

Yes, my example isn't what I was going for. Let's use a simpler example.
Let's say we have a system like Smalltalk where the base Object 
supports a method like:

- forward:methodName args:arguments

And the way this works is that when an object is sent a message it 
doesn't respond to, it invokes this method with the appropriate 
arguments.

Now, you'll see we have a situation where *all* objects can except 
*all* messages. And it can only be known at runtime if they want to 
deal with them or not.

How does static typing deal with this? It seems all the types in the 
system would have to be declared to respond to all methods, in which 
case, they tell us nothing and there is no such thing as a compile time 
type error.

-- Steve