Here's another: for-else, while-else and break statements

I'm a big fan of python's for-else, while-else and etc constructions. 
For those unfamiliar with the construct, it allows the "else" block to 
be run if the loop was not explicitly broken out of. It'd be pretty 
simple to implement via the macros, except we apparently don't support 
the "break" statement. Any way that we could implement it? Would 
something like this work?


#statement#
  whilst expr do statements else statements done ; =>#
  macro {
    macro lab1 is new;
    macro lab2 is new;
    macro lab3 is new;
    macro val break = goto lab3;
    lab1:>
      if not _1 goto lab3;
      _3;
      goto lab1;
    lab2:>
      _5;
    lab3:>
  };
#

-e

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to