From: Junio C Hamano <gits...@pobox.com>
>
> Christian Couder <chrisc...@tuxfamily.org> writes:
> 
>> For example some people might want:
>>
>>     if_exists = overwrite
>>     if_missing = add
>>
>> while others might want:
>>
>>     if_exists = overwrite
>>     if_missing = do_nothing
>>
>> and I don't see how we can say that with just:
>>
>>     action = do_Y_if_X_and_Z
> 
> Yes, but then we go back to my original question: why exists and
> missing are so special,

Because they are completely disjoint, easy to understand, and they can
avoid a lot of combinatorial explosion we would have if we used only
one "action" variable, while still providing lot of expressiveness.

They are just a good tradeoff for the special problem we have.

> and why there aren't two kinds of exists
> (i.e. "there exists an entry with the same <key, value>" vs "there
> exists an entry with the same <key>").

Because it doesn't improve expressiveness much, doesn't remove much
combinatorial explosion and make it significantly more difficult to
understand, compared to only "if_exists" and "if_missing".

> I would have understood your
> "this is not too hard to understand for users" if you had three
> (i.e. "missing", in addition to these two flavours of "exists"), but
> with only two, I do not see how it is useful in a hypothetical
> situation like above.

You mean that you do not see why:

     if_exists = overwrite
     if_missing = do_nothing

is simple and expressive?

> For example, how would you express something like this only with
> "if-exists" vs "if-missing"?
> 
>       if_exists_exactly = ignore
>         if_exists_with_different_value = append
>         if_missng = prepend_to_the_beginning

First, previously in the discussion you said that you didn't want us
to talk about the "where = (after | before)" part, because you could
see that it was orthogonal to the other stuff, but now it looks like
you want again to put that on the table.

Then yes, it is not possible to express the above with what I
implemented. But it could be possible with only "if-exists" vs
"if-missing" like this:

        if_exists = append_if_different
        if_missing = prepend

And yes I think it is much better than:

        if_exists_exactly = ignore
        if_exists_with_different_value = append
        if_missng = prepend_to_the_beginning

because we can still easily express things like:

        if_exists = append_if_different_neighbor
        if_missing = prepend

while it would be more difficult to understand with
"if_exists_exactly", "if_exists_with_different_value" and
"if_missing".

Thanks,
Christian.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to