[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:41:00 -0500 |
User-agent: |
Evolution 3.50.3 (by Flathub.org) |
On Mon, 2024-01-22 at 21:33 -0500, Dmitry Goncharov wrote:
> On Mon, Jan 22, 2024 at 8:16 AM Paul Smith <psmith@gnu.org> wrote:
> > I don't understand the point you are making about +!=.
>
> If all new operators behave the same as +=, when the variable exists,
> then +!= is not needed, because +!= would do the same as +=$(shell
> ...).
They are not equivalent since if the variable is recursive the +!=
model would execute the shell script immediately, one time, and append
the result, while += $(shell ...) would re-run the shell script every
time the variable was expanded.
In addition to efficiency, it could be a noticeable behavior if the
shell script does something (like list files or obtain a date or
something) which might change between invocations.
In other words in this situation:
foo = bar
foo +!= echo baz
then the value of foo would be "bar baz", while in this situation:
foo = bar
foo += $(shell echo baz)
the value of foo would be "bar $(shell echo baz)". Of course you can
rewrite it to be the equivalent, like this:
foo = bar
__foo := $(shell echo baz)
foo += $(__foo)
here bar has a value of "bar $(__foo)": as long as __foo was not reset
then it would give the same result as +!=.
--
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
- Re: New conditional assignment facility, (continued)
- Re: New conditional assignment facility, N. Thiebaud, 2024/01/11
- Re: New conditional assignment facility, Paul Smith, 2024/01/11
- Re: New conditional assignment facility, Dmitry Goncharov, 2024/01/20
- Re: New conditional assignment facility, Paul Smith, 2024/01/21
- Re: New conditional assignment facility, Dmitry Goncharov, 2024/01/21
- Re: New conditional assignment facility, Paul Smith, 2024/01/22
- Re: New conditional assignment facility, Jouke Witteveen, 2024/01/22
- Re: New conditional assignment facility, Martin Dorey, 2024/01/22
- Re: New conditional assignment facility, Jouke Witteveen, 2024/01/22
- Re: New conditional assignment facility, Dmitry Goncharov, 2024/01/22
- New append operators (was: Re: New conditional assignment facility),
Paul Smith <=
- Re: New conditional assignment facility, Paul Smith, 2024/01/27
- RE: New conditional assignm ent facility, rsbecker, 2024/01/27
- Re: New conditional assignm ent facility, Paul Smith, 2024/01/27
- RE: New conditional assignm ent facility, rsbecker, 2024/01/27
- New append operators (was: Re: New conditional assignment facility), Paul Smith, 2024/01/28
- RE: New append operators (was: Re: New conditional assignment facility), rsbecker, 2024/01/28
- Re: New append operators (was: Re: New conditional assignment facility), Paul Smith, 2024/01/28
- Re: New conditional assignm ent facility, Edward Welbourne, 2024/01/29
- RE: New conditional assignm ent facility, rsbecker, 2024/01/29
- Re: New conditional assignment facility, Edward Welbourne, 2024/01/29