Open
Description
Now that Bitcoin Cash is going to get increased VM limits, it becomes more plausible developers will want to use 'unrolled loops'. This would just be code repeated x times where x is known at compile time and cannot be a variable. The looping construct will only be able to take a number argument, not a variable.
If we were to enable it, the syntax should make clear to the developer that this loop will be unrolled in size and so any if branching logic will take up a huge amount of space. Either the keyword unroll
or unroll for
would make this very clear.
unroll(256) {
// Code to be unrolled and repeated 256 times
}
If people want to have a counter variable they would need to create this explicitly
int i = 0; // Initialize a counter variable
unroll(256) {
// Increment the counter explicitly
i = i + 1;
}