# D6140: revset: add new contiguous(x) function for "x::x"

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Mar 15 22:02:02 EDT 2019

In https://phab.mercurial-scm.org/D6140#89469, @gracinet wrote:

> I thought of "closure" as well, but I fear it has too many possible meanings, "transitive closure" being one of them in that context (certainly related, but not the same thing), and of course the closures in functional programming.
>
> I think "hull" could be appropriate, if not too pedantic.
>
> I couldn't find out quickly if people dealing with partial ordered sets theory (another way to think of DAGs) actually use "hull", but here's the analogy:
>  for the convex hull, you add [a, b] (line segment) to the set whenever a and b belong to it, for this "poset hull" you do the same with a::b (which in poset theory would be called the interval [a, b])

Wouldn't the hull pretty much be `heads(contiguous(x)) or roots(contiguous(x))`? Regardless, most users are not math nerds. I still think `contiguous()` is pretty clear. Sure, it won't join separate branches by adding ancestors or descendants, but I'm not sure there is a name that conveys that meaning too while not being too academic. @av6 also prefers `contiguous`, so we have two votes for that. I'm not sure how many votes for `closure` we have.

If we still want to find a better name, maybe it helps to remember that the function returns nodes that are *both* ancestors and descendants of some nodes in the input. Maybe something family-related (like "ancestors" and "descendants" are)? But I can't think of any term like that.

> This S::S operation seems to be a special case of Closure Operators in the sense of https://en.wikipedia.org/wiki/Closure_operator, which tells us that "hull" can indeed be used as alternative terminology in some cases where "closure" can be confusing (they quote topology). In that same article, there's inded yet another meaning in the context of partially ordered sets, as a generalisation of the very first definition (generalising the power set to any partially ordered set).
>
> /taking rusty mathematical hat off now

REPOSITORY
rHG Mercurial

REVISION DETAIL
https://phab.mercurial-scm.org/D6140

To: martinvonz, #hg-reviewers
Cc: av6, spectral, gracinet, marmoute, mercurial-devel