[Top][All Lists]

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

Re: [objc-improvements] Warnings when compiling GNUStep

From: Ziemowit Laski
Subject: Re: [objc-improvements] Warnings when compiling GNUStep
Date: Wed, 3 Sep 2003 16:46:49 -0700

On Wednesday, Sep 3, 2003, at 13:37 US/Pacific, Dirk Theisen wrote:

Hello, Ziemowit!

Let me first say, I'm glad someone is cleaning up the compiler.
It seems that you also have the relevant background knowledge to do it the "right" way.

You are touching a spot I long wish ObjC had it:

Covariant return types. Those are absolutely valid and I think you know that. If not, I can dig up the relevant (oldish) papers. This would give ObjC a little bit more expressive power in some cases and another advantage over Java.

Covariant return types (unlike covariant arguments :-) ) are valid in an OO-theoretic sense, but I'm not sure how well they it in with _existing_ Objective-C usage. For example, how should the compiler deal with invariant, unrelated or contra-variant return types?

What I want is to declare:

@interface ImmutableClass: NSObject

- (NSArray*) allElements;


@interface MutableClass: ImmutableClass

- (NSMutableArray*) allElements;


You can declare that today, without prejudice (or warnings). The problem arises if you're sending an 'allElements' message to 'id', which takes us back to the ongoing discussion on discuss-gnustep. :-) (BTW, I have contacted "the proper authorities" on setting up an Apple-hosted ObjC mailing list; please stay tuned.)

Ziemowit Laski                 1 Infinite Loop, MS 301-2K
Mac OS X Compiler Group        Cupertino, CA USA  95014-2083
Apple Computer, Inc.           +1.408.974.6229  Fax .5477

reply via email to

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