objective c - Make NSDate mutable -
is there way change value of nsdate without creating new instance of nsdate? i'd keep pointer same , replace underlying data.
first idea sublass nsdate , adding property keeps nsdate value...
i understand reasoning, yet think idea of mutable subclass dangerous:
the problem frameworks don't expect nsdate
instances change. thus, don't copy them in case of nsstring
or other classes conforming nsmutablecopying
.
also, nsdate
implements copy
retaining same instance , returning it. you'd have override behavior which, again, might unexpected.
the idea of nsdate
(similar nsnumber
) represent immutable value. it's difficult imagine how , frameworks rely on fact.
Comments
Post a Comment