You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While using Chapels IO+Regex features, I found some weird behavior with fileReader.matches.
Both of the following two programs result in infinite loops
use IO, Regex;
proc main() {
var r = openReader("foo.txt");
var re =new regex("X\\d+");
for m in r.matches(re) {
writeln("Got a match: ", m);
}
writeln("end");
use IO, Regex;
proc main() {
var r = openReader("foo.txt");
var re =new regex("X\\d+");
var matches = r.matches(re);
writeln(matches);
}
Is this the correct behavior? To make these be non-infinite, something must be done inside the loop that progresses the fileReader (e.g. extractMatch or advance). The second program has implicit parallelism, and will always be an infinite loop.
My reading of the documentation left me uncertain if this was the intended behavior.
Based on offline conversation, @mppf says he recalls that this infinite loop was the original intended behavior. However, it was generally agreed that the docs say thats not the intended behavior. We agreed that according to the docs, the correct behavior is that matches yields all the possible matches, after yield one match, the file reader is advanced to the end of the match where it looks for the next match.
Either way, this seems like a bug we should fix. Either the docs are wrong, or the code is wrong.
The text was updated successfully, but these errors were encountered:
While using Chapels IO+Regex features, I found some weird behavior with
fileReader.matches
.Both of the following two programs result in infinite loops
Is this the correct behavior? To make these be non-infinite, something must be done inside the loop that progresses the
fileReader
(e.g.extractMatch
oradvance
). The second program has implicit parallelism, and will always be an infinite loop.My reading of the documentation left me uncertain if this was the intended behavior.
Based on offline conversation, @mppf says he recalls that this infinite loop was the original intended behavior. However, it was generally agreed that the docs say thats not the intended behavior. We agreed that according to the docs, the correct behavior is that
matches
yields all the possible matches, after yield one match, the file reader is advanced to the end of the match where it looks for the next match.Either way, this seems like a bug we should fix. Either the docs are wrong, or the code is wrong.
The text was updated successfully, but these errors were encountered: