[BioCocoa-dev] Peptides...

Koen van der Drift kvddrift at earthlink.net
Tue Mar 29 17:38:54 EST 2005


On Mar 29, 2005, at 12:06 PM, Charles PARNOT wrote:
> The problem is that in the proposed implementation, you return an 
> NSArray, when in fact, it is a disguised NSMutableArray. This can 
> easily bite us or the user back, for instance:


Ah, now I see what you mean :)  Yes that could be a potential problem.  
I can think of two solutions:

Make the symbolArray ivar non-mutable, this would mean some additional 
chnages in the various init methods.  Or we return a mutable array from 
the accessor. I would prefer the second solution:

- (NSMutableArray *)symbolArray
{
	return symbolArray;
}

Using Cocoa/ObjC conventions, I wouldn't call the accessor 
mutableSymbolArray but just the name of the ivar. Also, we can always 
add an additional accessor to get a real copy.

I hope this answers your question?


cheers,

- Koen.


>
>   BCSequence *seq=[BCSequence sequenceWithString:@"ATGT"];
>   NSArray *symbols=[seq symbolArray];
>   int n=[symbols count];
>   [seq removeSymbolAtIndex:1];
>   BCSymbol *last=[symbols objectAtIndex:n]; //UNEXPECTED EXCEPTION
>
> Don't you guys think this is an issue? Sorry if I am insisting, but 
> you have not answered that particular point yet :-)
>
> charles
> -- 
> Help science go fast forward:
> http://cmgm.stanford.edu/~cparnot/xgrid-stanford/
>
> Charles Parnot
> charles.parnot at stanford.edu
>
> Room  B157 in Beckman Center
> 279, Campus Drive
> Stanford University
> Stanford, CA 94305 (USA)
>
> Tel +1 650 725 7754
> Fax +1 650 725 8021
> _______________________________________________
> Biococoa-dev mailing list
> Biococoa-dev at bioinformatics.org
> https://bioinformatics.org/mailman/listinfo/biococoa-dev
>




More information about the Biococoa-dev mailing list