bug-make
[Top][All Lists]
Advanced

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

Re: Order of expansion of recipe lines


From: Zoltan
Subject: Re: Order of expansion of recipe lines
Date: Mon, 14 Mar 2016 10:36:04 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 SeaMonkey/2.39

On 03/14/2016 07:22 AM, Paul Smith wrote:
> In the early days of GNU make where functions didn't really have side
> -effects (except for $(shell ...) which doesn't make much sense to use
> in a recipe anyway) it was very hard to notice this ordering.  But now,
> as we've added many more functions with side effects (not just info, but
> also eval, file, etc.), it's not hard to get surprising results.
> 
> I wonder if we shouldn't change the way we handle expansion of recipe
> lines to meet peoples' expectations: instead of expanding all recipe
> lines first we would expand recipe lines one at a time, as we got ready
> to run that line.
> 
> It would be a backward-incompatible change, although the fix is easy
> enough (just be sure you put everything you want to be expanded first in
> the first line of the recipe).  Still it's a change, which can involve a
> lot of work for people if they were scattering things around their
> recipe lines but expecting them to be expanded first.

I don't particularly see a reason to change current behavior, but if you want
to, how about implementing it like a "delayed" expansion except for recipe
lines, so instead of $(...whatever....), it would be written
$$(...whatever...) in order to not not break backward compatibility and still
allow new uses as you describe.  Sort of like in .SECONDEXPANSION
conceptually, and could maybe even be tied to .SECONDEXPANSION if needed.

Another $.02...

-- 
     ###  Any similarity between my views and the truth is completely ###
     ###     coincidental, except that they are endorsed by NO ONE    ###




reply via email to

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