[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Obj-C Namespacing
From: |
Helge Hess |
Subject: |
Re: Obj-C Namespacing |
Date: |
Thu, 4 Dec 2003 22:57:07 +0100 |
On 04.12.2003, at 22:41, Ziemowit Laski wrote:
That's right. I believe that adding namespaces to ObjC/ObjC++
constructs would actually require adding namespace support to the
runtime, and runtime metadata. :-(
Where do you see problems?
I can't think of anything too problematic, actually, aside from
actually agreeing to do it.
Hehe ;-)
One would have to come up with a way to "mangle" ObjC class/protocol
names so that they contain namespace qualifications and do not collide
with names constructed by hand. (E.g., mangling 'org.gnustep.MyClass'
as 'org_gnustep_MyClass' would not do, although you're probably right
that leaving it as 'org.gnustep.MyClass' might just do the trick.)
Well, as you already point out doing like Java is just fine in this
case ;-) The "." is not valid in an ObjC class or method name.
@namespace org.gnustep;
@interface MyClass : com.apple.Foundation.NSObject
- (id)blub;
@end
@end
---snap---
Should work and produce "org.gnustep.MyClass" as the class name in
the class lookup table.
Do I miss anything?
If you did, I can't see it. :-( My first inclination was to rely on
C++ namespace notation, but that would mean that only ObjC++ users
could benefit from the features. Your notation could work with both
ObjC and ObjC++, and seems quite reasonable.
Oh, yes. I would in no way try to mix up C++ and Objective-C. Using
them in a single source file is OK for me, but reusing C++ features in
ObjC is just huhuhuhu. Keep them separated.
So yes, I suggest using new, Objective-C specific directives for
Objective-C namespaces.
Anyway, I wonder whether someone is willing to implement that for some
upcoming GCC. I would certainly appreciate that and backwards
compatibility should be very good.
best regards,
Helge
--
OpenGroupware.org http://www.opengroupware.org/