🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Information hiding problem

#19
From: Tim Olson
Date: Thu, 09 Apr 1992 19:12
41 lines
1720 bytes
I've written a number of small Objective-C programs using the NeXT
appkit, but recently I tried a larger project that doesn't just
mainly use appkit objects.  I encountered a problem with information
hiding, and I was wondering what the best way around it was.  I think
that the basic problem is that the interface specification is used in
two different ways: 

	1) To define new methods that the object responds to, so that other
	   objects which call it can know the correct types to use for
	   method parameters and return values (prototypes).

	2) To define all object data which is "global" to the object (shared
	   by all methods), to allow for subclassing.

The two different uses seem to coexist ok when working with simple
data types, but consider an object implementation which uses a
structure, enum, or typedef (i.e.: 

---
#import <objc/Object.h>

enum State {Idle, Waiting, Running};

@interface MyObject: Object {
	enum State state;
	.
	.
};
---

When this interface file is included in another object's .m file to
define the messages, the enum declaration seems to behave with "file
scope", no matter where it appears in the file (before or after the
@interface declaration). 

Are there standard ways around this?

--
	Tim Olson
	Advanced Micro Devices
	tim@amd.com
Technical Details
Message-ID: <1992Apr9.191256.11311@dvorak.amd.com>
Path: arc1-ca.pugleaf.net!sparky!news.UU.NET!munnari.oz.au!mips!kpc!amdcad!dvorak.amd.com!usenet

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.objective-c
Path: arc1-ca.pugleaf.net!sparky!news.UU.NET!munnari.oz.au!mips!kpc!amdcad!dvorak.amd.com!usenet
From: tim@monolith.amd.com (Tim Olson)
Subject: Information hiding problem
Message-ID: <1992Apr9.191256.11311@dvorak.amd.com>
Sender: usenet@dvorak.amd.com (Usenet News)
Organization: Advanced Micro Devices, Inc.; Austin, Texas
Date: Thu, 9 Apr 92 19:12:56 GMT
Lines: 41