[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [objc-improvements] Warnings when compiling GNUStep
From: |
Kai Henningsen |
Subject: |
Re: [objc-improvements] Warnings when compiling GNUStep |
Date: |
03 Sep 2003 11:50:00 +0200 |
zlaski@apple.com (Ziemowit Laski) wrote on 02.09.03 in
<FF2A40A7-DDA3-11D7-94DF-000393673036@apple.com>:
> they match up). However, in a few cases we're dealing with the idiom
>
> [[ClassName alloc] init...]
>
> in which case one _could_ make the argument that any method named
> 'alloc' should be treated
> specially by the compiler, i.e., as having a return type covariant with
> the receiver. What
> do you think? If we don't teach the compiler about 'alloc', then it is
> perfectly within
> its right to complain in this case also, unless we change foregoing to
> read
>
> [(ClassName *)[ClassName alloc] init...]
>
> which, I must admit, does have a slighty redundant flavor to it. :-(
> Of course, the
> slippery slope argument applies here (if we treat 'alloc' specially,
> then what about
> 'allocWithFoo:Bar:'?...)
Or [xxx initXXX...], which is often the same situation ...
... and which suggests a rule:
Iff calling a method on id, and this id is the return value of a method
call, and the method we want to call is supported by the receiver of
*that* method call, accept it. (alloc, init, new are examples of this
idiom.)
Sorry, not particularly elegant ...
MfG Kai
- [objc-improvements] Warnings when compiling GNUStep, Ziemowit Laski, 2003/09/02
- Re: [objc-improvements] Warnings when compiling GNUStep, Ziemowit Laski, 2003/09/03
- Re: [objc-improvements] Warnings when compiling GNUStep, Alexander Malmberg, 2003/09/03
- Re: [objc-improvements] Warnings when compiling GNUStep, Ziemowit Laski, 2003/09/03
- Re: [objc-improvements] Warnings when compiling GNUStep, Riccardo Mottola, 2003/09/04
- Re: [objc-improvements] Warnings when compiling GNUStep, Alexander Malmberg, 2003/09/04
- Re: [objc-improvements] Warnings when compiling GNUStep, Ziemowit Laski, 2003/09/04
- Re: [objc-improvements] Warnings when compiling GNUStep, Alexander Malmberg, 2003/09/04
- Re: [objc-improvements] Warnings when compiling GNUStep, Ziemowit Laski, 2003/09/04
- Re: [objc-improvements] Warnings when compiling GNUStep, Nicola Pero, 2003/09/05