ср, 3 апр. 2019 г. в 22:54, Kapil Jain <jkapil.cs@xxxxxxxxx>: > > Reference: https://git.github.io/SoC-2019-Ideas/#unify-ref-filter-formats-with-other---pretty-formats > > I have spent some time with both pretty.* and ref-filter.* > > First off, we are aiming to reuse ref-filter, so avoiding any sort of > re-implementation is recommended. It is recommended, but it's normal situation to re-implement something as a middle step. > > Now, coming to pretty.* and ref-filter.* > > suppose, a function named xyz() in ref-filter.c seems like it could be > reused in pretty.c. > since ref-filter doesn't use any struct of pretty.c. The xyz() > function in its original form is not useful for pretty.c. > So now, in order for the xyz() function to be useful in pretty.c. > Function xyz() should be using structs of pretty.* > > now, if we make xyz() use the pretty.* structs, then its > re-implementation and not reusing. its like keeping two different > functions one for ref-filter and another for pretty.*. > which is what is already happening. It's OK as the middle step. Another approach is to add using ref-filter structures and continue using existing ones, so that you have 2 duplicating flows of data. Reuse ref-filter logic, and then in the end of the patch delete duplicating logic from pretty. Both these approaches could be useful, choose any of them or design your own way. I deleted so much code that I wrote, I advice you try not to afraid of it. It's OK to make something and then rewrite it several times. The only thing that matters is the final result. > > please provide any starting point for reusing ref-filter. i don't see > any in pretty.*. > reusing ref-filter specifically in pretty.* is not the motive. please > point out any file in entire code base, that you may feel can reuse > some ref-filter logic.