From: Chris Gehlker Date: 2002-10-17T14:46:35+09:00 Subject: Re: Interfaces in Ruby On Wednesday, October 16, 2002, at 09:29 PM, Jim Weirich wrote: > On Wed, 2002-10-16 at 22:19, Chris Gehlker wrote: > >> I don't agree that an interface, in the Java sense, and an abstract >> class, in the Java/C++ sense are synonymous > > An abstract class in C++, with all pure virtual methods and no data, is > semantically equivalent to a Java interface[1]. They are often used in > C++ programs in ways similar to Java interfaces. > Yes it is. In that case, they are functionally equivalent. >> There are also: >> 3) Idiosyncratic but very clever uses as, for example, in the STL, >> where it is somewhat obscured by all the template stuff, and in >> GNUStep >> where it isn't. > > I'm not sure what you are refering to here, but it sounds interesting. > Examples? In GNUStep, for example, GSArray and GSMutableArray are never actually instantiated even though they are foundation types. What gets returned from the constr is a pointer to some specific type depending on the size and number of elements. Some of the methods in GSMutableArray actually return a pointer to a different member of the class cluster than the original receiver of the message, which constructs the sibling instance, copies it's data and immolates itself. All this stuff is going on behind the scenes in the interest of faster execution speed. As a user, you just don't have to think about it. > >> I'll try and translate my drawing program [with class cluster >> examples] > >> from ObjC to Ruby. > > I, too, am interested in seeing this. > I'll get busy. -- As an adolescent I aspired to lasting fame, I craved factual certainty, and I thirsted for a meaningful vision of human life - so I became a scientist. This is like becoming an archbishop so you can meet girls. -Matt Cartmill, anthropology professor and author (1943- )