[cfe-dev] override support for Objective-C
Alexei Svitkine
alexei.svitkine at gmail.com
Mon Nov 29 17:27:26 PST 2010
The benefit of an @Override annotation (for e.g. as implemented in Java) is
for the compiler to warn you if you're not actually overriding something
when you think you are. Which could happen if the superclass changed since
the time you wrote the code or if you made a typo in the method
name/signature.
This is completely orthogonal to overloading. (Though I don't know Stuart's
actual intention.)
-Alexei
On Mon, Nov 29, 2010 at 8:13 PM, Chris Lattner <clattner at apple.com> wrote:
>
> On Nov 29, 2010, at 4:09 PM, Stuart Carnie wrote:
>
> Hi all,
>
> I would like to have a go at hacking a little on Clang when a get a bit of
> spare time, and have found that adding support for override would be useful
> little exercise. I've seen another post referring to Clang's support for
> __attribute__((override)), and seems like I could use this as a starting
> point.
>
> Big Nerd Ranch <http://weblog.bignerdranch.com/?p=171> would like to see
> an @override keyword, as follows:
>
>
> @override
> - (NSInteger)numberOfSectionsInTableview:(UITableView *)tv
> { ... }
>
>
> Hi Stuart,
>
> Is your goal here to allow overloading of ObjC methods? If so, the
> parsing isn't the hard part, you'd need to mangle selectors somehow, and
> enhance the runtime to support this. This isn't something we want in ObjC,
> because want to keep it simple.
>
> -Chris
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101129/a518d9d5/attachment.html>
More information about the cfe-dev
mailing list