[ExM Users] nested foreach and variable scope

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


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/e75940a5/attachment.html>


More information about the ExM-user mailing list