Mac Apps That Use Garbage Collection Must Move to ARC

ponce via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 26 03:28:15 PST 2015


> or:
>
>   f = open_file(…)
>   g = open_file(…)
>   h = open_file(…)
>   if( error(f,g,h) ) log_error
>
>
> Also with async programming, futures/promises, the errors will 
> be delayed,

That's the problem with future/promises, you spent your time 
explaining who waits for what instead of just writing what things 
do.


> so you might be better off having them as part of the object.

No. If I can't open a file I'd better not create a File object in 
an invalid state. Invalid states defeats RAII.

So you can't re-enter that mutex as you asked, so I will grant 
you a scopedLock, but it is in an errored state so you'd better 
check that it is valid!



More information about the Digitalmars-d mailing list