suggested improvements to D

BCS ao at pathlink.com
Tue Jan 9 10:07:30 PST 2007


Reply to Warren,

> Here are some suggested improvements for D.
> 
[...]
> labeled break and continue statements:
> that was a fine idea to eliminate a lot of gotos.
> HOWEVER, the most common way in which gotos happen that's not covered
> by D's
> break and continue is this:
> for(some loop condition){
> if(something){ goto A; }
> }
> fallthru_code;
> A:
> break_out_code;


loop: while(false)
{
  for(some loop condition)
  {
    if(something) break loop;
  }
  fallthru_code;
}
break_out_code;

the dummy labeled loop body might be just useful enough to make this legal

bod: {     // labeled compound statement
   if(cond)
      break bod;
   else
      continue bod;
   }





More information about the Digitalmars-d mailing list