skaller wrote:
> * In your code _5 is never executed. The Python form
> you are so fond of is hard to understand, I don't
> understand what it does .. and neither do you!

Whoops, typo :) This is what I meant:

#import <flx.flxh>
#keyword otherwise

#statement#
  whilst2 expr do statements otherwise 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 lab2;
      _3;
      goto lab1;
    lab2:>
      _5;
    lab3:>
  };
#

var i = 0;
whilst2 i < 5 do
  print i; endl;
  if i > 2 do
    print "breaking"; endl;
    break;
  done;
  i++;
otherwise
  print "finished without a break"; endl;
done;

endl;

i = 0;
whilst2 i < 5 do
  print i; endl;
  i++;
otherwise
  print "finished without a break"; endl;
done;

-----------------
0
1
2
3
breaking

0
1
2
3
4
finished without a break

>
> Try this .. noting the STILL ugly failure to properly
> detect the last iteration.
[snip]

neat! I like that a lot. It reminds me a lot of the lisp looping macro. 
Once we refine this down a bit and extend it to for, until, and etc, 
think it'd be worthwhile to put it in the standard library?


> Some notes:
>
> * you cannot use 'else' as a separator here.

Thats okay. "else" isn't really the most sensible word for what this 
construct is. I like your example, and "otherwise" may be close, but I 
still think something may still be more appropriate.

> * For some reason I do not understand, you need this:
>
>     macro var break = { goto lab3; };

Another bug on the list! :)
>
> What I don't understand at the moment is why this works
> with a macro var, but NOT a macro val.
And another!





-------------------------------------------------------------------------
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