[ExM Users] nested foreach and variable scope

Tim Armstrong tim.g.armstrong at gmail.com
Fri Jun 27 17:12:07 CDT 2014


Yep, I can reproduce this on trunk, I created an issue for it:
https://code.google.com/p/exm-issues/issues/detail?id=716

- Tim


On Fri, Jun 27, 2014 at 5:02 PM, Tim Armstrong <tim.g.armstrong at gmail.com>
wrote:

> That sounds like a bug.  I'll see if I can reproduce.
>
> - Tim
>
>
> On Fri, Jun 27, 2014 at 4:54 PM, Ketan Maheshwari <ketan at mcs.anl.gov>
> wrote:
>
>> Consider the following two cases:
>>
>> 1.
>> main{
>>     file files[] = glob("adir/*.txt");
>>     string commands[]=split(read(input_file("./commands.txt")),"\n");
>>
>>     foreach afile, i in files{
>>             printf("%s", filename(afile));
>>         foreach command, j in commands{
>>             printf("%s", command);
>>         }
>>     }
>> }
>>
>> 2.
>> main{
>>     file files[] = glob("adir/*.txt");
>>     string commands[]=split(read(input_file("./commands.txt")),"\n");
>>
>>     foreach afile, i in files{
>>         foreach command, j in commands{
>>             printf("%s", filename(afile));
>>             printf("%s", command);
>>         }
>>     }
>> }
>>
>>
>> Case 1 works while 2 shows error at runtime as follows:
>> can't read "u:afile": no such variable
>>     while executing
>> "turbine::file_read_refcount_incr ${u:afile} [ expr { ${tcltmp:iters} - 1
>> } ]"
>>
>> Any clue?
>>
>> Thanks,
>> Ketan
>>
>> _______________________________________________
>> ExM-user mailing list
>> ExM-user at lists.mcs.anl.gov
>> https://lists.mcs.anl.gov/mailman/listinfo/exm-user
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/exm-user/attachments/20140627/b1544434/attachment-0001.html>


More information about the ExM-user mailing list