On 21 April 2018 at 05:43, Junio C Hamano <gitster@xxxxxxxxx> wrote: > but I do not think the updated "fix" below is better. It might be > just aesthetics and I suspect I won't find it as disturbing if we > could push with > > object_array_push(commits, (struct object *)commit); > > or something that is more clearly symmetric to object_array_pop(). > The "Queue again" comment is needed only because use of "add" > highlights the lack of symmetry. > > With add_object_array(), it looks somewhat more odd than your > previous > > peek it to check; > if (it should not be molested) > return; > pop to mark it consumed; > consume it; > > sequence, in which peek() and pop() were more obviously related > operations on the same "array" object. > > And I do not think it is a good idea to introduce _push() only for > symmetry (it would merely be a less capable version of add whose > name is spelled differently). Hence my preference for peek-check-pop > over pop-oops-push-again-but-push-spelled-as-add. > > Not worth a reroll, though. I just wanted to spread better design > sense to contributors ;-) Thanks for your wise words. :-) One thing that just occurred to me is that if the original site where we `add_object_array()` all objects starts adding a non-NULL `name` for some reason, then we need to remember to do the same with this new caller. I suspect that at that time, at the latest, we will be switching to peek-check-pop. Thanks for sharing your thoughts. Martin