Cw Confusion.
I've been playing around with Cw alot since the preview was released. I'm pretty sure that I'm starting to understand the concepts now. However the following problem still has me puzzled:
using System;
public class Test
{
static int* FromTo(int a, int b)
{
for(int i=a; i<b; i++)
yield return i;
}static void Main()
{
FromTo(0,10).ToString().{Console.Write(it);};
}
}
yields the following output:
Test+closure:496621
I would have expected:
0123456789
I've also tried this which does the same thing:
string* nums = FromTo(0,10).ToString();
nums.{Console.Write(it);};
This seems to work:
FromTo(0,10).{Console.Write(it.ToString());};
But, what I wanted to see work was the "lifting" of the ToString() method across all the ints. I'm chalking this up to alpha bits. I think whats happening is the compiled code is getting confused between the ToString() of System.Int32 and the ToString() that is part of a codegened "closure" class. On the other hand I could be totally missing something.