Implementing typestate

Idan Arye via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 16 03:31:56 PDT 2015


On Wednesday, 16 September 2015 at 06:25:59 UTC, Ola Fosheim 
Grostad wrote:
> On Wednesday, 16 September 2015 at 05:51:50 UTC, Tobias Müller 
> wrote:
>> Ola Fosheim Grøstad <ola.fosheim.grostad+dlang at gmail.com> 
>> wrote:
>>> On Tuesday, 15 September 2015 at 20:34:43 UTC, Tobias Müller 
>>> wrote:
>>>>> There's a Blog post somewhere but I can't find it atm.
>>>> 
>>>> Ok found it: > 
>>>> http://pcwalton.github.io/blog/2012/12/26/typestate-is-dead/
>>> 
>>> But that is for runtime detection, not compile time?
>>
>> Not as far as I understand it.
>> The marker is a type, not a value. And it's used as template 
>> param.
>> But you need non-copyable move-only types for it to work.
>
> Yes... But will it prevent you from doing two open() in a row 
> at compiletime?

What's wrong with two `open()`s in a row? Each will return a new 
file handle.


More information about the Digitalmars-d mailing list