[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnustep-base collection classes now support generics
From: |
David Chisnall |
Subject: |
Re: gnustep-base collection classes now support generics |
Date: |
Tue, 23 Feb 2016 09:14:03 +0000 |
On 22 Feb 2016, at 21:24, Niels Grewe <address@hidden> wrote:
>
> Hi guys,
>
> A while back Apple introduced support for lightweight (type-erasing) generics
> in Objective-C. In my opinion, this is a really nice feature because it
> increases (compile-time) type safety and makes API contracts much more
> explicit. Since there is nothing particular to Apple’s flavour of Objective-C
> in respect to this feature, GNUstep automatically gained support for it
> through clang. Still, the interfaces require updating to expose this to users
> and I’ve now gone through gnustep-base and updated the collection classes
> (NSArray, NSCache, NSDictionary, NSSet and their subclasses) to properly
> declare the generic types of their elements.
> This is a huge win in terms of portability for code originally built using
> the iOS 9 or MacOS X 10.11 SDKs: Previously if you had used generics
> annotations on a collection (which I think is the most common case), your
> code just wouldn’t compile with gnustep-base.
> This change should be a no-op for users of gcc or older clang versions that
> lack the objc_generics feature. If it still breaks stuff for you, please
> shout at me loudly so that I can fix things ASAP.
Thanks! I started working on this before becoming demotivated to work on
GNUstep for a bit by the pre-Christmas whining thread. Have you also looked at
adding instancetype to the various places that expect it and at the nullability
attributes? The latter is primarily intended for Swift interop, but does make
the static analyser results more useful (and can generate better code in a few
places, though not by much).
David
-- Sent from my brain