Re: WIP patch to reduce rewrite_filename duplication

2024-04-26 Thread Bruno Haible
Collin Funk wrote: > > Correct. Feel free to add tests for --copy-file, if you like. > > I didn't spend time on it, since --copy-file is simple enough. > > Sure, I can have a look at adding some. I see it is part of the Gnulib > Savannah group so I can commit changes there. I assume same rules go

Re: WIP patch to reduce rewrite_filename duplication

2024-04-25 Thread Collin Funk
On 4/25/24 5:14 PM, Bruno Haible wrote: > Yes, the other heuristic is that when many functions operate on the > same object, like methods in class do, the pointer to that object > is often passed first. And, as you noticed, the two heuristics collide... > > Here, I would not think of

Re: WIP patch to reduce rewrite_filename duplication

2024-04-25 Thread Bruno Haible
Hi Collin, > > Yep, that's the right way to do it. Maybe file_name should come first > > (by the usual heuristic that the argument that shows most variation > > comes first)? > > Sure, that is fine with me. I think the other way is based on how I > like to write C. Usually I like to place

Re: WIP patch to reduce rewrite_filename duplication

2024-04-25 Thread Collin Funk
Hi Bruno, On 4/25/24 1:18 PM, Bruno Haible wrote: > Yep, that's the right way to do it. Maybe file_name should come first > (by the usual heuristic that the argument that shows most variation > comes first)? Sure, that is fine with me. I think the other way is based on how I like to write C.

Re: WIP patch to reduce rewrite_filename duplication

2024-04-25 Thread Bruno Haible
Hi Collin, > > IMO, the creation of a rewrite_file_name method (singular! you mentioned > > a couple of days ago that the ability to rewrite a single file name is > > one of the motivations for this refactoring) in a central place goes in > > the correct direction. However, moving knowledge about

Re: WIP patch to reduce rewrite_filename duplication

2024-04-25 Thread Collin Funk
Hi Bruno, Thank you for the detailed explanations as always. On 4/25/24 1:48 AM, Bruno Haible wrote: > Object-oriented programming is not easy, and it comes with constant > hesitations and deliberations. :) My least favorite part of my degree was object-oriented design and database

Re: WIP patch to reduce rewrite_filename duplication

2024-04-25 Thread Bruno Haible
Hi Collin, Object-oriented programming is not easy, and it comes with constant hesitations and deliberations. > Less repeated code to maintain. Yes, this is one of the goals to keep in mind. The other most relevant questions are: - Can the purpose of a class be explained in simple terms?