Implementing typestate
Freddy via Digitalmars-d
digitalmars-d at puremagic.com
Tue Sep 15 11:01:19 PDT 2015
On Tuesday, 15 September 2015 at 17:45:45 UTC, Freddy wrote:
> ...
I just thought of some corner cases and how to solve them.
---
Disallow global variable with typestate (there might be a better
solution down the line).
The evaluated typestate of variables after going through
branches (if,for,etc...) must be the same.
Example
---
void func(){
File f;
if(someVar){
f.openWrite("a.txt");
}
//error here one branch where f is none, another branch where
f is open
}
---
More information about the Digitalmars-d
mailing list