[PATCH 3 of 9 V2] obsolete: clarify the obsstore `precursors` and `successors` mapping

Matt Mackall mpm at selenic.com
Mon Oct 15 15:33:25 CDT 2012


On Mon, 2012-10-15 at 09:01 -0500, Augie Fackler wrote:
> On Oct 15, 2012, at 7:46 AM, pierre-yves.david at logilab.fr wrote:
> 
> > +    - precursors: old -> set(marker using <old> as precursor)
> > +    - successors: new -> set(marker using <new> in successors)
> 
> This documentation helps a lot, thanks.

It'd be clearer still as:

  precursors[x] -> set(markers with x as a precursor)
  successors[x] -> set(markers with x as a successor)

But..

> Given that this is internal code, I'd like to propose flipping the
> naming of these attributes. The reason being is that (probably because
> of my math background) I read obsolete.precursors(ctx) as "precursors
> of ctx", which sounds to me like the result of successors(ctx) in the
> current code. Does anyone else read the code that way?

Yes, the only sensible way to read precursors[x] or precursors(x) or
x.precursors() is "precursors of x". In fact, we settled on these names
after hours of discussion precisely because they couldn't reasonably be
read any other way (like the earlier obsoletes(x) could), because
reading them backwards is hopeless confusing. So if it's actually doing
things the other way, it does need to be flipped:

  precursors[x] -> set(markers on precursors edges of x)
  successors[x] -> set(markers on successors edges of x)

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list