DMD 0.148 - scope guard

Dawid Ciężarkiewicz dawid.ciezarkiewicz at gmail.com
Sun Feb 26 12:10:31 PST 2006


Dawid Ciężarkiewicz wrote:
> What do you think? Maybe later we'll come with better ideas.

VERSION I: (yeah, I know ...)

h3r3tic on #D channel said that VERSION H is too long and too switch-like.

This is hybrid of two concepts - verbose and informative "register" keyword
and short usage without switch-like syntax.

void LongFunction()
{
    State save = UIElement.GetState();
    register (scopepass) UIElement.SetState(save);
    register (scopefail) UIElement.SetState(Failed(save));
    ...lots of code...
}




More information about the Digitalmars-d mailing list