On Thu, 2021-08-12 at 15:19 +0000, Austin Group Bug Tracker wrote: > After page 2894 line 97263 add: > > <blockquote>The following form defines a delayed-expansion macro > (replacing any previous definition of the macro named by > <i>string1</i>): > > <tt><i>string1</i> :::= <b>[</b><i>string2</i><b>]</b></tt> > > by immediately expanding macros in <i>string2</i>, if any, before > assigning the value.</blockquote> > > On page 2895 line 97310, change: > > <blockquote>The macro $$ shall be replaced by the single > character > '$'.</blockquote> > > to: > > <blockquote>The string "$$" shall be replaced by the single > character > '$', except during the immediate expansion performed for the :::= > operator, > where it shall be left unmodified.</blockquote>
So I took a look at implementing this in GNU make since it seems to have been adopted. I just can't understand the point of this change. Can someone provide me with some example(s) of this :::= operator showing how it might be used and what problems it is trying to solve? The idea behind this completely escapes me so I'm wondering if I'm somehow misinterpreting the text above defining how :::= is supposed to work. I can sort of understand why someone might want to immediately expand a variable but then treat the expansion as delayed-expansion (although as I pointed out in the issue comments, you can already do this without this new operator you just have to use two variables, and I haven't had anyone ask me for this capability). But what is the point of having an immediately expanded variable where variables are expanded but "$$" is preserved? This I can't really fathom. Also, it's not clear to me whether preserving the '$$' only applies to the unexpanded string, or also applies to the expansion of variables contained in the string. For example, what would be the expected result of this: foo = one$$two bar :::= $(foo) three$$four all:;@echo '$(bar)' Is the internal value of the "bar" variable 'one$$two three$$four', so that the result of running make is: one$two three$four or is the internal value of the "bar" variable 'one$two three$$four', so that the result of running make is: onewo three$four