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

Re: dynamic vs. static typing

On 2003-11-19T02:22:49-0800, Steve Dekorte wrote:
> 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?

One way to express what you said here, if I understand you correctly,
is to have respondsToTurnOff (a special case of respondsTo:) return a
certificate (understood by the type system) that the object will indeed
respond to turnOff.  The simplest such certificate is an object of the
type that does respond to turnOff -- the same object.

Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
Put something activist here!

Attachment: signature.asc
Description: Digital signature