DMD 0.148 - scope guard
Dawid Ciężarkiewicz
dawid.ciezarkiewicz at gmail.com
Sun Feb 26 04:47:27 PST 2006
Dawid Ciężarkiewicz wrote:
> VERSION E:
> void LongFunction()
> {
> State save = UIElement.GetState();
> onscope {
> case success: UIElement.SetState(save);
> }
> onscope {
> case failure: UIElement.SetState(Failed(save));
> }
> ...lots of code...
> }
Just came to my mind:
This version is especially neat because it may be simplified to:
void LongFunction()
{
State save = UIElement.GetState();
onscope {
case success: UIElement.SetState(save); break;
case failure: UIElement.SetState(Failed(save));
}
...lots of code...
}
More information about the Digitalmars-d
mailing list