Re: Mutability
Re: Mutability
- Subject: Re: Mutability
- From: Ondra Cada <email@hidden>
- Date: Thu, 22 Nov 2001 21:45:28 +0100
Andrew,
>
>>>>> Andrew Pinski (AP) wrote at Thu, 22 Nov 2001 14:24:26 -0500:
AP> What about mutable=[array respondsToSelector:@selector(addObject:)]; ?
AP> Then you don't have to worry about customs classes, that someone might
AP> send to you.
That would be a nice workaround, *IF ONLY* Apple had not the *GRAVE* bug
there as well :((((((
=== just have a look ===
48 /tmp> cat q.m
#import <Foundation/Foundation.h>
int main(void) {
id pool=[NSAutoreleasePool new];
id a=[NSArray array];
id b=[NSMutableArray array];
NSLog(@"a %@ %d %d",[a class],[a isKindOfClass:[NSMutableArray
class]],[a respondsToSelector:@selector(addObject:)]);
NS_DURING [a addObject:@""]; NS_HANDLER NSLog(@"a IMMUTABLE!!!"); NS_ENDHANDLER
NSLog(@"b %@ %d %d",[b class],[b isKindOfClass:[NSMutableArray
class]],[b respondsToSelector:@selector(addObject:)]);
NS_DURING [b addObject:@""]; NS_HANDLER NSLog(@"b IMMUTABLE!!!"); NS_ENDHANDLER
return 0;
49 /tmp> cc q.m -framework Foundation && ./a.out
2001-11-22 21:40:13.739 a.out[691] a NSCFArray 1 1
2001-11-22 21:40:13.740 a.out[691] a IMMUTABLE!!!
2001-11-22 21:40:13.741 a.out[691] b NSCFArray 1 1
50 /tmp>
=== end ===
Timeo Apple et CoreFoundation ferentes :((((
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.cz
private email@hidden
http://www.ocs.cz/oc