declaring variants/subports in loops and loop variables

Brandon Allbery allbery.b at gmail.com
Wed Dec 7 17:09:35 CET 2016


On Wed, Dec 7, 2016 at 10:20 AM, René J.V. Bertin <rjvbertin at gmail.com>
wrote:

>     variant python${pv} description "Add bindings for Python ${pdv}" {
>         depends_libs-append port:python${pv}
>         # snip
>     }
>

tcl tends to encourage you to think that { } is a block construct, and in
many languages that would close over the values of referenced variables.
It's not. It's a quoted string, and the expansion of $pdv and/or $pv will
be deferred until that quoted string is passed internally to tcl's eval. At
that point, any values for those variables must come from elsewhere.

Use a double quoted string and escape anything that needs it (but
specifically not those variables for which you need the current value).

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20161207/ed3cb04d/attachment.html>


More information about the macports-dev mailing list