Implementing typestate
BBasile via Digitalmars-d
digitalmars-d at puremagic.com
Tue Sep 15 11:25:49 PDT 2015
On Tuesday, 15 September 2015 at 18:15:46 UTC, Freddy wrote:
> On Tuesday, 15 September 2015 at 18:10:06 UTC, BBasile wrote:
>> Ok, sorry I didn't know this concept so far.
>> So there would be a kind of 'compile-time instance' of File
>> with a modifiable member ?
>
> A simplified version of this:
> https://en.wikipedia.org/wiki/Typestate_analysis
> Where types can have compile time state(enum) that change as
> they are used.
Ok, I see. So type states can be used in static analysis to find
possible bugs if certain states-pattern are not found. In the
file example if after FState.open, fState.close is never found
then a compiler could emitt a warn about a possible leak or
something...wow that's pretty edgy...
More information about the Digitalmars-d
mailing list