Re: Prototype mutableArray savechanges error
Re: Prototype mutableArray savechanges error
- Subject: Re: Prototype mutableArray savechanges error
- From: Chuck Hill <email@hidden>
- Date: Wed, 27 May 2009 13:42:08 -0700
On May 27, 2009, at 12:49 PM, Anjo Krank wrote:
Am 27.05.2009 um 21:40 schrieb Chuck Hill:
Anjo had some way of using this safely, but you need to be aware
that EOF is NOT expecting the contents of that array to change.
Huh? Me? What?
You scolded me last time I said to not use mutable attributes and
grumbled about the mutable prototype in Wonder being dangerous. Some
non-sense like:
But apart from that, as most have said by now: using ERXMutableArray
as an attribute value is totally ok, only using the mutable part of
the API of the array is not. I.e. don't use addObject(), create a
clone, add to that and setFoo() it.
What is the point of making a mutable attribute if you can't use it as
a mutable value? It just positively BEGS to be misused. This whole
thread is evidence of that. There is no additional complication that
I can see in using an immutable array:
public void addBar(Bar bar) {
setFoo(foo().mutableClone().addObject(bar));
}
public void addBar(Bar bar) {
setFoo(foo().arrayByAddingObject(bar));
}
But you had some reason for wanting it to be a mutable instance. Some
performance concern perhaps?
Chuck
No idea where the stack overflow comes from. Setting an exception
breakpoint may or may not help...
Cheers, Anjo
--
Chuck Hill Senior Consultant / VP Development
Come to WOWODC'09 in San Fran this June!
http://www.wocommunity.org/wowodc09/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden