我想知道使用 Chapel 的forall
. 使用CDO 库的这段代码失败了,我确信这样做是正确的。有人能给我一个很好的例子吗?
var j:int = 0;
writeln("\n=== FORALL LOOP ===");
forall row in cursor {
writeln("from: ", row['from_nm'], "\tto: ", row['to_nm']);
j += 1;
}
writeln("Expected 10 rows, got ", j);
错误是
faerr.chpl:59: error: illegal lvalue in assignment
faerr.chpl:57: note: The shadow variable 'j' is constant due to forall intents in this loop