[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 6:29 PM, Ken Shan wrote:
>> 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.
>
> Indeed, in a system like Smalltalk, there is no such thing as a compile
> time type error.

Ok, now:
1. forwarding is a very flexible and powerful mechanism
2. you agree that a type system is useless with forwarding

Given that there is little reason to make a fully ST language that has 
forwarding (as it breaks the assumptions of ST) our choices are:

1. DT language that can support a flexible and powerful feature such as 
forwarding
2. ST language that cannot

So we find ourselves with an example of a form of power and flexibility 
that only DT systems offer and therefore another reason to choose DT 
language. (which was my original point)

Btw, there are many languages other than Smalltalk (and that are 
radically different than Smalltalk) that support forwarding and more 
generally, inheritance through delegation. Examples include 
Prototype-based and Actor-based languages. Paradigms that I think 
could, respectively, be of significant benefit to programmer 
productivity and performance/scalability.

-- Steve