bug-make
[Top][All Lists]
Advanced

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

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


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

On Sat, 2024-01-27 at 17:45 -0500, rsbecker@nexbridge.com wrote:
> My take on it is that +:= (because of the : ) means that you have to
> resolve everything at that point.

Yes, I understand what you are saying.  The question is, is that the
right conception?  Here's another way to look at it:

    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.

My argument is, if you want to write "FOO := $(FOO) bar" you can just
write that today: you don't need "+:=" (you will have an extra leading
space if FOO was not set already but that's unlikely to matter much).

But if you want the second form it's tricky to do.

It can also be argued that the second form is closer to the behavior of
"+=" since "+=" keeps the pre-existing type of the variable rather than
changing it.  Although of course it's still special in some respects.

-- 
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]