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

Re: dynamic vs. static typing

On Nov 18, 2003, at 11:01 PM, Ken Shan wrote:
> On 2003-11-18T22:34:09-0800, Steve Dekorte wrote:
>>>    Konstantin Läufer. 1996.  Type classes with existential types.
>>>    Journal of Functional Programming 6(3): 485-517.
>> Please summarize.
> I'm sorry, but I feel that you want me to be your academic assistant or
> understudy, and I don't have the time or desire to do that.  Please 
> read
> the abstract and/or apply your other skills for reading research 
> papers.

Well, I thought I was just asking you to explain your position. But no 

>> What if I want to send a message to all the objects in the list that
>> respond to a method, but not to those that don't? For example, let's
>> say I have a list of things in my house and I want to send a turnOff
>> message to everything that can be turned off.
> As Anton van Straaten explained beautifully, all the objects in this
> case respond to some message like "turn off if you can", or "can you
> turn off?".

We'll say that all implement, say, a "respondsTo:" method (that takes a 
string argument and returns True or False) and some (but not all) 
implement a turnOff method.

Can we have a type that declares that an object implements respondsTo: 
and *may* implement turnOff? If so, how does it prevent the possibility 
of a "does not respond to turnOff" error?

-- Steve