discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dia2code objc


From: Richard Frith-Macdonald
Subject: Re: dia2code objc
Date: Tue, 26 Mar 2002 14:21:45 +0000

On Tuesday, March 26, 2002, at 01:36 PM, Björn Gohla wrote:

On Tuesday 26 March 2002 13:36, Helge Hess wrote:
Björn Gohla wrote:
i am working on a dia2code plugin for objective-c. i have some issues
with class member visibility. public attributes are represented in objc via a set/get pair, and private ones by the absence of it. but is there
any useful interpretation of protected attributes, if so how?

Actually private/protected/public attributes should probably be mapped
to instance variables ? ivars do support those flags:

@interface MyClass
{
@private
   id myPrivate;
@protected
   id myProtected;
@public
   id myPublic;
}
@end

perhaps this can be done without changing the compiler, by using an
authentication mechanism like the one in NSProxy. the accessor methods could check whether the caller is allowed to access the variable, we can even have write only and read only access and different access rights for different
classes, try that with c++ ;) .

IMO getting very complex/sophisticated about this is a waste of programming effort and produces confusing code. Access restrictions cannot be enforced,
so sticking to simple conventions is more effective.

eg. provide different headers containing different categories listing methods available for specialised use, and document who is supposed to use each API
in the appropriate header.

While you can provide methods which do clever checking at runtime, it's
rarely justified.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]