This seems to work fine
file = File("test.txt", "r");
with (file)
{
scope(exit) close();
foreach (string line; file.lines())
{
line_array ~= line;
}
}
however:
file = File("test.txt", "r");
with (file)
{
scope(exit) close();
foreach (string line; lines())
{
line_array ~= line;
}
}
Tells me I'm attempting to read from an unopened file, what's
going on here? It seems like I'm able to use lines() like this
within with statements unless they're in my foreach iterator. Is
this a bug or intended behaviour?