request switch statement with common block

MattCoder mattcoder at hotmail.com
Sat Aug 3 11:51:22 PDT 2013


On Saturday, 3 August 2013 at 18:04:03 UTC, Walter Bright wrote:
> On 8/3/2013 10:45 AM, w0rp wrote:
>> I can see you saving a little bit of typing with this, but it's
>> not worth it.
>
> It would be a very unconventional syntactic form, and my 
> experience with such things is it'll see very, very little use.

I would like to use this topic and ask if it would be possible to 
extend a feature of D language like in this case related by the 
author.

Imagine that a user want to put a trigger when "switch statement" 
match some option, wouldn't be nice if D could do something like 
this:

switch(x){
    onBeforeMatch = callFoo();

    case n1:
    ...
    case n2:
    ...
}

Where onBeforeMatch could be onAfterMatch.

Matheus.


More information about the Digitalmars-d mailing list