gpu.js
gpu.js copied to clipboard
Assignment in a for final expression is no longer supported
What is wrong?
I can no longer use an assignment in the expression that gets evaluated after each loop in a for statement because an exception is raised. It used to work on v1.10.4.
Where does it happen?
I've seen this in node and in the browser, in ubuntu and in mac os. Using gpu.js version 2.0.2.
How do we replicate the issue?
const { GPU } = require('gpu.js');
const gpu = new GPU();
const f = gpu.createKernel(function() {
let sum = 0;
for (let i = 0; i < 5; i += 1) { // i = i + 1 also fails
sum += 1;
}
return sum;
}).setOutput([5]);
f();
How important is this (1-5)?
1 — the code can be rewritten using a while, but it can make upgrading to v2 more difficult
This works now, at least in v2.6.6.
Thanks!