[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnustep-base collection classes now support generics
From: |
Niels Grewe |
Subject: |
gnustep-base collection classes now support generics |
Date: |
Mon, 22 Feb 2016 21:24:57 +0000 |
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.
Cheers,
Niels
- gnustep-base collection classes now support generics,
Niels Grewe <=