[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: building dbuskit fails with llvm/clang
From: |
Nicola Pero |
Subject: |
Re: building dbuskit fails with llvm/clang |
Date: |
Sun, 10 Apr 2011 13:30:17 +0200 (CEST) |
> I think the correct solution is to allow something like this:
>
> @class<NSObject> GSStackTrace;
>
> This would forward-declare the class, and also advertise that
> it conforms to the NSObject protocol.
It's an interesting suggestion, and has good merit. :-)
I would personally not like it that much because:
* well, I like a simple language and I'm worried about feature-creep. :-)
* @class only exists to allow you to deal with circular references
when declaring classes. So, really, every @class should later
be followed by a corresponding @interface.
* I would agree that compilers very lax behaviour in that respect (where
'@class A' makes anything of class A practically equivalent to 'id') is
counter-productive as it doesn't enforce or recommend that at all.
If you message an object of a class which is only declared using @class,
you should get a warning. Both GCC and clang don't warn about this.
GCC also allows class methods to the class again with no warnings;
clang doesn't (in fact it produces a hard error, which is the "problem"
reported above). I like the clang behaviour a lot, and I submitted a bug
report to GCC requesting the warning (maybe not an error) for GCC too.
I'm not entirely sure why clang makes a difference between class and
instance methods. I would like the warning on instance methods too! :-)
Having said that, the idea is creative and nice.
Thanks