DIP44: scope(class) and scope(struct)

Walter Bright newshound2 at digitalmars.com
Sat Aug 24 12:27:37 PDT 2013


On 8/23/2013 5:44 PM, H. S. Teoh wrote:
> I've written up a proposal to solve the partially-constructed object
> problem[*] in D in a very nice way by extending scope guards:
>
> 	http://wiki.dlang.org/DIP44

Not a bad idea, but it has some issues:

1. scope(failure) takes care of most of it already

2. I'm not sure this is a problem that needs solving, as the DIP points out, 
these issues are already easily dealt with. We should be conservative about 
adding more syntax.

3. What if the destructor needs to do more than just unwind the transactions? 
Where does that code fit in?

4. The worst issue is the DIP assumes there is only one constructor, from which 
the destructor is inferred. What if there is more than one constructor?



More information about the Digitalmars-d mailing list