Interfaces - the next step

Peter Smet peter.smet at flinders.edu.au
Fri Jul 9 06:46:44 UTC 1999


I downloaded the SmallInterfaces code and was impressed. The documentation
is very good - and I think Interfaces will be a useful thing. What strikes
me as a problem is that an Interface is really a composite. To truly reason
about Interfaces it is not enough to treat them as a bunch of selectors. To
me, the function of an Interface is as a prerequisite for communcation
between objects. In its present form, objects with compatible interfaces may
NOT be able to communicate.

For example, the interfaces
1: do: [^1]
2: do: [: aNumber | ^aNumber printString]

Are incompatible and most definitely not interchangeable. However, they are
declared to be compatible with the present Interfaces approach. An interface
is compatible with another Interface if its interface AND the interface of
its parameters AND its return interface are identical. Since the interface
of a parameter may in turn be composed of selectors with parameters this
looks like a perfect case for recursive composition. This means that an
Interface will look more like:

Magnitude's Interface
> IMagnitude return IBoolean
< IMagnitude return IBoolean

or If a Comparable Interface existed:
> IComparable return IBoolean
and so on for <, =, etc

I think it would be good to extend interfaces to work more in this manner,
and I suspect that Giles Brachad has already solved all of these issues and
a lot more in Strongtalk. What has happened to this code - is it an out of
reach commercial product, or is the code gathering dust somewhere? Could it
be adapted for use in Squeak with his permission?

Peter





More information about the Squeak-dev mailing list