[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Possible bug: sending messages to Class objects
From: |
Helge Hess |
Subject: |
Re: Possible bug: sending messages to Class objects |
Date: |
Mon, 14 May 2001 10:36:56 +0200 |
Hi,
Class is a generic type, it can't be used by the type-validator. GNU
ObjC provides no way to statically type a class instance. The only
workaround I know is to define a protocol.
@protocol MKTuningSystem
-transpose:(double)semitones
@end
id<MKTuningSystem> aTuningClass = [MKTuningSystem class];
Besides that GNU gcc indeed seems to have some problems choosing between
class and instance methods, though I have no sample ready.
Greetings
Helge
Stephen Brandon wrote:
>
> Hi,
>
> Before I go and do a really deep investigation of this problem, I thought I'd
> throw it to the list
> and see if anyone can point me in the right direction.
>
> I'm working on the GNUstep port of the SndKit and MusicKit, of NeXTStep fame.
> Progress is going very
> well on MacOS X...
>
> Anyway, I am getting the following error when compiling on GNUstep:
>
> parseScore.m: In function `tune':
> parseScore.m:2825: warning: multiple declarations for method `transpose:'
> /usr/GNUstep/System/Headers/AppKit/NSResponder.h:192: warning: using
> `-(void)transpose:(id)sender'
> MKTuningSystem.h:190: warning: also found `-transpose:(double)semitones'
> parseScore.m:2825: incompatible type for argument 3 of indirect function call
>
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Weird!!!
>
> The lines in question are:
> Class aClass = [MKTuningSystem class];
> [aClass transpose:val];
>
> (also tried [MKTuningSystem transpose:val]; but that fails in exactly the
> same way)
>
> I am comfortable about the fact of a multiple declaration, but I am more
> concerned that it is
> preventing me from accessing a Class method with the same signature.
>
> MKTuningSystem has a class method: +transpose: (double)semitones as well as
> instance method the
> same. If I change the name of the class method, and call the renamed version,
> then I don't get the
> error, but I don't want to change our API.
>
> Other info: the parseScore.m file is not actually an objective C class, and
> the error is inside a
> function not a method.
>
> More info: running on very latest CVS version of GNUstep, on Caldera
> OpenLinux 1.3 with lots of
> customisations, gcc --version gives egcs-2.91.66.
>
> Can anyone shed any light on this? Is it likely to be a compiler error - if
> so, which version should
> I upgrade to, and are there any tricks to doing so? Any other directions to
> search in?
>
> Thanks,
> Stephen Brandon
> stephen@pyrusmalus.com
>
> ps I am not on this list: please cc: any replies to me at the above address
>
> _______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> http://mail.gnu.org/mailman/listinfo/discuss-gnustep
--
SKYRIX Software AG - http://www.skyrix.com/
Web Application Technology for Enterprises