request switch statement with common block

luminousone rd.hunt at gmail.com
Sun Aug 4 23:28:10 PDT 2013


perhaps a more generic solution should be looked at, extend 
contracts to work with all scope blocks.

switch(somenumber)
in {
     ... before stuff ...
}
out {
     .... after stuff ...
}
body {
     case 1:
     in {
        ... etc ....
     }
     out {
        ... more etc ...
     }
     body {
        ...
     }
     case 2:
       // and so on
}

or perhaps

for( int i = 0 ; i < 10 ; i ++ )
in {
     assert( i == 0 );
}
out {
     assert( i == 9 );
}
body {
    ... stuff ...
}

if it is desired for a particular contract block to be called in 
release builds perhaps a attribute label to mark it as a runtime 
block or something similar.

foreach( i, k ; somerange )
@runtime in {
  ...
}
body {
}


More information about the Digitalmars-d mailing list