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
static variables should be able to be implemented with closures. For example: int fun() { static int count = 0; count++; return count; }
can be implemented as:
var fun = _Static_fun()
func _Static_fun() func() int {
var count int
return func() int {
count++
return count
}
}
This should be easy to implement because all that must be done is move all static variables to the top and create the closure with the rest of the code.
Indeed, that could be a way, but closures proved to be problematic, since the expression might appear either as lhs or rhs, so you will need to return pointer there. And the code gets far less readable which I'd like to avoid as much as I can. So the plan was to allocate unique names for static, and just keep them in the global scope.
Currently
static
specifier is ignored, leading to incorrect code (variable is defined in the local scope, with the lifetime of a block).This is a serious issue and it must be addressed.
The text was updated successfully, but these errors were encountered: