[Biococoa-dev] BCSequenceRecord

Charles Parnot charles.parnot at gmail.com
Sun Jul 10 20:26:53 EDT 2005

On Jul 10, 2005, at 5:21 PM, Koen van der Drift wrote:

> On Jul 10, 2005, at 8:11 PM, Charles Parnot wrote:
>>> But if there is a way to have the immutable bcsequence have an  
>>> NSData property and the mutable version have an NSMutableData  
>>> then that would be more elegant obviously...
>>> Cheers,
>>> Alex
>> You can set an ivar to be NSData, but make it an NSMutableData  
>> anyway. With the proper casts, the compiler won't tell anything,  
>> and the runtime won't bother... As long as you don't call the  
>> wrong methods on the wrong type!!
> That's seems very dangerous too!  I prefer Alex's suggestion, by  
> using NSData for the immutable sequence and NSMutableData for the  
> mutable one.
> - Koen.

Yes, but then you have two different ivars. Which means all the  
method you write for the immutable cannot be used for the mutable one  
(for instance, the init methods). Or at least, they can't use the  
ivar directly, but only a accessor that return either the mutable or  
the immutable ivar, cast as NSData. Which could work fine too, so  
maybe this is the solution. Do you see what I mean, I am not sure  
what I wrote is clear?


Help science move fast forward:

Charles Parnot
charles.parnot at gmail.com

More information about the Biococoa-dev mailing list