Then I got fed up with it and implemented new stuff. A whole 5 minutes later, and the arrow operator exists. The arrow operator (->) is a type-expression operator. It takes two types and creates a static method signature as you might expect:
public static test(int x) => void { print x;}public static main() => void{ local int -> void op = test; op(5); // 5}
Or, a more complex example which is still not as elegant as list comprehensions...
public static elements in (IEnumerable<int> collection) where (int -> bool predicate) => yields<int> { foreach( int x in collection ){ if( predicate x ){ yield(x); } }}public static (int min) to (int max) => yields<int> { local int counter = min; while( counter < max or counter equals max ){ yield(counter); counter = counter + 1; }}public static (int n) is even => bool { return( n%2 equals 0 );}public static main() => void{ foreach( int x in elements in 3 to 10 where (int n) => bool{ return( n is even ); } ){ print x; }}
Which would be sweet if it worked. There's a bug with yielding from within an if block which the last hour has not fully diagnosed. Still; a few people were looking for more complex examples, and there you go.
[edit: 90 minutes, no progress on the bug. It is a problem for blocks not resetting their execution pointers as they should after a yieldy block is restarted. Should be more simple when I can think again. It is the same problem I had earlier with nested loops and yield blocks. if stuff is a little more nuanced since you don't know when/if it's restarted via loop.
Definitely makes the .NET switch/jump hack look a lot more elegant.]
[edit2: the second example now works properly.]