Feature request: First class labels

BCS ao at pathlink.com
Sun May 6 15:41:30 PDT 2007


Reply to Walter,

> They're a good idea, but they are a fair amount of work to implement,

Mostly just curiosity, but what makes them hard/not-easy?

> and their utility is not much beyond doing interpreters.
> 

they can also be used to remove conditionals from loops


|for(int i = 1; i<1000000; i++)
|{
| if(complex_loop_invariant)
|  nothing();
| else
|  that()
| if(complex_loop_invariant2)
|  other();
| else
|  bat();
|}

// no tests in loop.
|void* l1 = complex_loop_invariant ? &&a : &&b;
|void* l2 = complex_loop_invariant2 ? &&c : &&d;
|
|for(int i = 1; i<1000000; i++)
|{
| goto *l1
| a:  nothing();
|     goto l2:
| b:  that()
|     goto l2:
| c:  other();
|     break;
| d:  bat();
|}

and other fun things I can't talk about for a few days





More information about the Digitalmars-d mailing list