declaring variants/subports in loops and loop variables

Joshua Root jmr at macports.org
Wed Dec 7 17:20:10 CET 2016


On 2016-12-8 04:14 , René J.V. Bertin wrote:
> On Wednesday December 07 2016 10:07:31 Ryan Schmidt wrote:
>
> Hi,
>
>
>> The boost port shows a typical example of using "eval" and "subst" to ensure the variable values are substituted immediately.
>
> In a nutshell, put the whole block where you want to force using the current values of all variables inside the curly braces of
>
> eval [subst {}]
>
> That seems to do the trick all right. I was a bit hoping for a `foreach` option to make limit the scope of the loop variable and all variables declared inside the loop, but that would probably be much more complicated to implement.
>
> Is this the "strongly preferred" way or is it just as fine to use `if {[variant_isset xx]}` or `if {${subport} eq ...}`?

No, it's pretty much a terrible idea. Just don't use braces if you want 
substitution.

- Josh


More information about the macports-dev mailing list