DMD 0.148 - scope guard

Cris central_p at hotmail.com
Sun Feb 26 11:36:29 PST 2006


Why do you need "case" at all?

Dawid Ciężarkiewicz wrote:
> Dawid Ciężarkiewicz wrote:
>> What do you think? Maybe later we'll come with better ideas.
> 
> VERSION F:
> void LongFunction()
> {
>     State save = UIElement.GetState();
>     register (scopepass) UIElement.SetState(save);
>     register (scopefail) UIElement.SetState(Failed(save));
>     ...lots of code...
> }
> 
> 
> VERSION G:
> void LongFunction()
> {
>     State save = UIElement.GetState();
>     register (scope) {
>         case pass: UIElement.SetState(save); break;
>         case fail: UIElement.SetState(Failed(save));
>     }
>     ...lots of code...
> }
> 
> VERSION H:
> void LongFunction()
> {
>     State save = UIElement.GetState();
>     register {
>         case scopepass: UIElement.SetState(save); break;
>         case scopefail: UIElement.SetState(Failed(save));
>     }
>     ...lots of code...
> }
> 
> 
> P.S.
> If I get more ideas I will throw them all (with those already posted) in one
> new thread.



More information about the Digitalmars-d mailing list