DMD 0.148 - scope guard
Dawid Ciężarkiewicz
dawid.ciezarkiewicz at gmail.com
Sun Feb 26 11:55:52 PST 2006
Cris wrote:
> Why do you need "case" at all?
Good point. Intention was to make it similar to switch (smth.) block.
void LongFunction()
{
State save = UIElement.GetState();
register (scope) {
pass: UIElement.SetState(save); break;
fail: UIElement.SetState(Failed(save));
}
...lots of code...
}
This looks better. I think about "(scope)" part. It's redundant _but_ very
informative and leaves open doors for expanding.
Currently I like this syntax best. IMO it naturally fits, "register" keyword
is old (but rarely used) old C-keyword and it realy means: "register this
piece of code to be called when something with scope happens".
More information about the Digitalmars-d
mailing list