I asked this question in OZ forum and I'm asking it here again. The question is Why a state variable is wrapped in a struct in their
Counters library. Please see the question in that post. Thanks.
Struct helps you to reduce the stack height while compiling. For compilations that have many threads, or say many local variables, (where stack support only 16) you may run into this error:-
Stack too deep when compiling inline assembly: Variable headStart is 1 slot(s) too deep inside the stack
But struct helps to reduce the number of local variables and consider them together as a single variable. And thus avoiding the error.
This article may help more about this.