🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.objective-c
Article #280

Re: Optional static typing limits

#280
From: Ken Lerman
Date: Thu, 18 Apr 1991 11:52
52 lines
2006 bytes
In article <LIBERTE.91Apr16164831@babbage.ncsa.uiuc.edu> liberte@ncsa.uiuc.edu (Daniel LaLiberte) writes:
|>
|>----- file A.h ----------
|>// interface of class A
|>
|>#include "B.h"   // A needs to include B's interface
|>
|>@interface A:Object
|>{
|>	B *b;   // instance variable b is a pointer to B
|>	...
|>}
|>
|>----- file B.h ----------
|>// interface of class B
|>
|>#include "A.h"   // B needs to include A's interface  <-- *ERROR*
|>
|>@interface B:Object
|>{
|>	A *a;   // instance variable a is a pointer to A
|>	...
|>}
|>
|>Dan LaLiberte
|>National Center for Supercomputing Applications
|>liberte@ncsa.uiuc.edu

A (not very nice) way of handling this in Stepstone's Objective-C
compiler is to write struct __objcA *a and struct __objcB *b to
declare the instance variables.

A better way would be for the compiler to permit @interface A {} @end
to be an incomplete definition of class F which could be completed
later on.

A further deficiency of Objective-C regarding automatic and static
instances of objects (those that are declared Object foo, instead of
Object *foo) is that the compiler doesn't automatically call an
initializer for them so that only the isa pointer is set.  This
implies that the writer of the class must know that it will be used
this way.

I personally don't use them and suggest that others avoid them, also.


Ken

Disclaimer: In case you haven't noticed, I work for Stepstone.  I
don't speak for them in this matter.

lerman@stepstone.com
Technical Details
Message-ID: <6785@stpstn.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!cs.utexas.edu!uunet!hsi!stpstn!lerman
References: <LIBERTE.91Apr16164831@babbage.ncsa.uiuc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!cs.utexas.edu!uunet!hsi!stpstn!lerman
From: lerman@stpstn.UUCP (Ken Lerman)
Newsgroups: comp.lang.objective-c,comp.lang.misc
Subject: Re: Optional static typing limits
Message-ID: <6785@stpstn.UUCP>
Date: 18 Apr 91 11:52:12 GMT
References: <LIBERTE.91Apr16164831@babbage.ncsa.uiuc.edu>
Reply-To: lerman@stpstn.UUCP (Ken Lerman)
Organization: The Stepstone Corporation, Sandy Hook, CT 06482
Lines: 52