On Jan 8, 2016, at 09:59 , Etan Kissling <kissl...@oberon.ch> wrote:
> 
> As the comments in the sample project describe in the introductory comments,
> modifying the code to force an NSSet does not solve the problem.

a. I believe your debugger display problems are just that — problems in the 
debugger, not necessarily anything to do with your code (though certainly 
getting in the way). I’ve seen other cases where the debugger generates huge 
output (many megabytes of text) and ties Xcode up for 20 minutes or more while 
doing it.

b. With your original Set<Foo> code, the set does indeed change from a Swift 
internal implementation to a _XXX_NSSet implementation after you add an entry 
via the array controller, though this is probably irrelevant.

c. With your Set<Foo> code, you should probably be using ==, not isEqual, even 
though the Foos are NSObjects.

d. For NSObject equality, the hash getter method is called ‘hash’, not 
‘hashValue’.

I don’t know offhand if Swift tries to bridge between ‘hash’ and ‘hashValue’ 
under any circumstances. (It seems like it must, otherwise I don’t see how Set 
and Set<> could bridge properly, but I admit I haven’t taken the time to try to 
think this through.) However, I suspect that your immediate problems are cause 
by the lack of a ‘hash’ method. Certainly, when I changed the Set<Foo> variable 
to NSMutableSet, your hashValue method wasn’t ever called.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to