discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ANN] PyObjC for GNUstep


From: David Chisnall
Subject: Re: [ANN] PyObjC for GNUstep
Date: Thu, 21 Jul 2011 13:20:47 +0100

On 21 Jul 2011, at 13:13, Stefan Bidi wrote:

> On Thu, Jul 21, 2011 at 2:10 AM, Fred Kiefer <fredkiefer@gmx.de> wrote:
>> I am not interested in Python, but looked over your changes to see what 
>> functionality is missing or different in GNUstep. One thing that I noticed 
>> was that this code expects that result of a copy operation on an 
>> NSMutableArray is a mutable array, and that on GNUstep you had to use 
>> mutableCopy. If this is true we should change the GNustep behaviour and add 
>> a test case for this.
>> Any other interesting stuff you found while working on this?
> 
> That's probably because NS(Mutable)Array objects in Cocoa are actually 
> NSCFArray objects (due to the toll-free bridging mechanism), which can be 
> either mutable or immutable.

I just tested it, and the GNUstep behaviour is correct.  [NSMutableArray -copy] 
does return an immutable array:

        NSMutableArray *a = [NSMutableArray new];
        id b = [a copy];
        [b addObject: @"foo"];

This terminates with an exception:

2011-07-21 13:17:19.940 a.out[15566:903] *** Terminating app due to uncaught 
exception 'NSInternalInconsistencyException', reason: '*** -[NSCFArray 
insertObject:atIndex:]: mutating method sent to immutable object'

So, it's probably one of the many bits in the PyObjC code that didn't work on 
GNUstep because it was Just Plain Wrong™ and shouldn't work on OS X either.

David


reply via email to

[Prev in Thread] Current Thread [Next in Thread]