[chuck-users] wishlist for the new year

Joe McMahon mcmahon at ibiblio.org
Sat Jan 2 23:23:13 EST 2010


On Fri, Jan 1, 2010 at 11:15 PM, Michael Heuer <heuermh at gmail.com> wrote:
> 2.  Java-style interface abstract classes, or multiple class inheritance
Or maybe Objective-C style protocols?

These work sorta like this:

 (void) foo (int)bar: <protocol1, protocol2> {
 ...
}

Which just says "this code will conform to the 'protocol1' and
'protocol2' protocols. Protocols are then sorta like Java interfaces;
they define the methods (with signatures) that the class must
implement and may implement. Much more flexible for a more dynamic
language. "Okay, I implemented foo, bar, and baz with the right
signatures, so I conform to the X protocol." Any class that implements
the required methods can then be used by any method that requires an
object confirm to the protocol - and the caller doesn't care what the
class is, just what it does. It can do anything else in addition it
wants to.

 --- Joe M.


More information about the chuck-users mailing list