Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!pa.dec.com!shlump.nac.dec.com!engage!ootool.dec.com!tenny From: tenny@ootool.dec.com (Dave Tenny) Newsgroups: comp.sys.next Subject: How do make Objective-C handle circular class references, HELP! Message-ID: <1991Feb19.012656.2785@engage.enet.dec.com> Date: 19 Feb 91 01:21:35 GMT Sender: news@engage.enet.dec.com (USENET News System) Organization: Digital Equipment Corporation Lines: 39 I've read all my NeXT Objc docs, including the more useful and no longer present with V2.0 Chapter 3 from NexT 1.0 docs on Objc. If there isn't a solution I have to "undo" a class and inline it as a struct, doubling the complexity of the class inlining it. Yuck. (It's a lot of QuadTree code). Basically, I have this ... in file X.h ... ... in file Y.h ... #import "Y.h" #import "X.h" @interface X @interface Y { { Y *d ; X *e ; } } There's more in the classes of course, but the jist is they are cooperating object classes. But I can't figure any way to get Objective C to handle these circular references, since it lacks the equivalent of C++ "Class X" forward declaration construct, and the interfaces aren't the same as C structure tags. The only solution I have so far is to make all occurances of one instance of circular reference (say Y in class X) be of type "id". But then they'll all incur extra method lookup, and lose the static type checking. Speed is crucial in theses particular objects, and I like to keep static checking when I can get it. I tried some macro tricks, but nothing worked satisfactorily. If you know the solution, please let me know. This is "real" code, I'm not just trying to come up with yet-another-complaint about yet-another-compiler. Many thanks for help... Dave