Concept proposal: Safely catching error

Olivier FAURE via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 8 06:42:21 PDT 2017


On Thursday, 8 June 2017 at 12:20:19 UTC, Steven Schveighoffer 
wrote:
> Hm... if you locked an object that was passed in on the stack, 
> for instance, there is no guarantee the object gets unlocked.
>

This wouldn't be allowed unless the object was duplicated / 
created inside the try block.

> Aside from the point that this still doesn't solve the problem 
> (pure functions do cleanup too), this means a lot of headache 
> for people who just want to write code. I'd much rather just 
> write an array type and be done.
>
> -Steve

Fair enough. There are other advantages to writing with "create 
data with pure functions then process it" idioms (easier to do 
unit tests, better for parallelism, etc), though.


More information about the Digitalmars-d mailing list