bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New append operators (was: Re: New conditional assignment facility)


From: Paul Smith
Subject: Re: New append operators (was: Re: New conditional assignment facility)
Date: Sun, 28 Jan 2024 18:35:30 -0500
User-agent: Evolution 3.50.3 (by Flathub.org)

On Sun, 2024-01-28 at 18:06 -0500, rsbecker@nexbridge.com wrote:
> >     FOO +:= bar
> > 
> > can be interpreted as working like this:
> > 
> >     FOO := $(FOO) bar
> > 
> > which is what you and others are arguing for.  Or it can be
> > interpreted as working
> > like this:
> > 
> >     __FOO := bar
> >     FOO += $(__FOO)
> > 
> > (where the value of __FOO is immutable).  This is what I was
> > thinking.
> 
> I do not think the above two are equivalent.

??  They're definitely NOT equivalent.  That's the point.  What I was
trying to say is that there are two DIFFERENT ways to interpret +:=.

You can either interpret "FOO +:= bar" to behave the same as
"FOO := $(FOO) bar" which is what you are suggesting.

Or you can interpret "FOO +:= bar" to be more-or-less equivalent to
writing:

  __FOO := bar
  FOO += $(__FOO)

If and only if __FOO was not modified after this.  Of course there is
no way to guarantee that __FOO is not modified after this: there is no
such thing as an immutable variable in GNU Make.

So in that way this interpretation of "+:=" would be more powerful than
anything you can already do in GNU Make today and this would be a truly
new capability, not just a shorthand for "FOO := $(FOO) bar" (which you
can already easily write if that's what you want).

-- 
Paul D. Smith <psmith@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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]