Re: Yet another API evolution: multi-valued GrlData




On Tue, 25 Jan 2011 13:37:24 +0100, "Juan A." Suárez Romero <jasuarez igalia com> wrote:
On Tue, 2011-01-25 at 12:14 +0000, Iago Toral wrote:
So what would a normal "set" do if it does not replace?


It could do nothing, if we don't allow to overwrite data, or append, if
we don't want to loss the current data, but get new one.


And what do you think the API user would expect? My experience is that when I do a "set" operation on something, the old value is replaced with the new one... if I want to keep both I do not use set, I use add/append. If I do not want to overwrite a value that is already there (only makes sense if I know there is a value), then the normal thing to do is first check if there is a value there already, and do the set only if no value is present.

My point: if 95% of the time the expected behaviour for set is "set and replace if necessary", let's do that, no need for a replace in that case. All the other (less common) possibilities you mention are already covered with other APIs in natural ways.

Iago


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]