declaring variants/subports in loops and loop variables

René J.V. Bertin rjvbertin at gmail.com
Thu Dec 8 08:49:27 CET 2016


On Thursday December 8 2016 12:54:05 Joshua Root wrote:

>> doesn't really help (me).
...
>Changing that to this will solve the problem:

Indeed, but not what I meant to say. 

>No, my intention was to show that the variable is not in the correct 
>scope. Adding a global declaration would still illustrate that but in a 
>less obvious way.

For me the example was too obviously wrong, and frankly I started understanding how it was "almost exactly the same situation" only after I had looked at `proc variant`. But even now that I know that variant "code blocks" are executed after the whole Portfile has been parsed and not inside the loop, I still fail to see how constructive it is to introduce a condition that is being avoided in "base". After all the seemingly counterintuitive issue underlying this thread is not caused by making global variables available to the code being executed, but by the fact that the execution takes place outside the loop. That's how I look at it, at least; knowing that I won't make the mistake again (I hope :)).
Anyway, not much point in dwelling on that, you got your message through.

R.


More information about the macports-dev mailing list