Thanks David, I did not know NSMapTable existed, and indeed, providing the ability to have ZWRs to the objects (but still copied keys) is exactly what I was after. Can you elaborate on exactly how Apple's semantics here are "wrong"?
Finally, the particular project I'm working on at the moment is a non-ARC project, can you define what "ARC mode" means in this context? Do I understand you correctly in that you're simply saying that I can use __weak as normal to create a weak reference to the map table if the file containing the reference is compiled with -fobjc-arc? Am I correct in thinking that weak referenced objects within the map table will still work fine even if no file in my project is compiled with ARC enabled? Thanks Tom Davie On 14 Jun 2012, at 10:09, David Chisnall wrote: > NSMapTable and NSPointerArray work in GC mode. They were working in ARC > mode, but it turns out that Apple implements the wrong semantics for them so > they're now broken to be Apple compatible. > > In both ARC and GC modes, the __weak qualifier works correctly[1], so there's > no reason why implementing such a thing should be hard. Reintroducing the > sane semantics for NSMapTable and friends (where weak means weak) as an > optional GNUstep extension is something that has been on my todo list for a > while but got bumped down by higher-priority things. > > David > > [1] If you compile with clang and link with GNUstep libobjc > > On 14 Jun 2012, at 10:04, Thomas Davie wrote: > >> Hi all, >> >> Just wondering before I go off and code my own... Does anyone know of an >> implementation of a weak dictionary (or array/set for that matter) that >> compiles successfully on GNUstep? There's obviously MAWeakDictionary, but >> that's heavily reliant on chunks of CF that don't exist. I could go out >> there and make an NSDictionary like thing that wraps every object you put in >> it in a weak reference object, but it seems like there should be a pre-baked >> solution to this. >> >> Tom Davie >> _______________________________________________ >> Discuss-gnustep mailing list >> [email protected] >> https://lists.gnu.org/mailman/listinfo/discuss-gnustep > > > -- Sent from my PDP-11 > _______________________________________________ Discuss-gnustep mailing list [email protected] https://lists.gnu.org/mailman/listinfo/discuss-gnustep
