On Mon, 2024-01-22 at 08:15 -0500, Paul Smith wrote: > Let's step back and I'll try to think more clearly about this.
Sorry for the delay in replying. I can see that I was thinking about this one way but there's another way to look at it that I didn't think of. We are talking only about (a) append operators _other than_ +=, and (b) situations where the variable already has a value when the append operator is parsed. In all cases we would expand the right-hand side of the variable according to the assignment operator: e.g., if it were +:= we would immediately expand the RHS. My proposal was to keep the type of variable (recursive vs. simple) the same and then "fix up" the result of the RHS so it could be appended in a correct way. In this conception the operator applies ONLY to the RHS value, and will set the type of the variable only if the variable doesn't already exist, as a side-effect. The other way to think about it is that the assignment operator overrides the type of the variable as well: we would re-evaluate the LHS value then append the RHS. E.g., if it were +:= we would immediately expand the RHS as well and change the type of simple. In this conception the operator resets the type of the variable as its primary function, not just as a side-effect, and modifies not just the RHS value but also (possibly) the LHS value as well. An example to make this clearer: Given: foo = 1 bar = $(foo) foo = 2 bar +:= $(foo) foo = 3 bar += $(foo) $(info bar=$(bar)) In my original version, the result would be that "bar" is a recursive variable with the value "$(foo) 2 $(foo)" and the output of the info function would be "bar=3 2 3". In the alternative version, the result would be that "bar" is a simple variable with the value "2 2 3" and the output of the info function would obviously be "bar=2 2 3". I'm interested in peoples' opinions about which of these two implementations they would feel to be more "intuitive" or "correct". Also please consider issues of "action at a distance" where a variable is assigned in one makefile and appended to in some other makefile, potentially far away. This discussion has really helped me crystallize the differences and should make the resulting documentation, if/when it's written, much more clear so I definitely appreciate it! -- Paul D. Smith <psm...@gnu.org> Find some GNU make tips at: https://www.gnu.org http://make.mad-scientist.net "Please remain calm...I may be mad, but I am a professional." --Mad Scientist