And just so you're getting a clearer picture: typedef vec = (a:int, b:int, c:int); fun + (x:vec, y:vec)=>(a=x.a + y.a, b=x.b + y.b, c=x.c + y.c); var x = (a=1,b=2,c=3); var y = x + x + x + x; println$ (y.a, y.b, y.c);
generates this: PTF y = _art57793(_art57793(_art57793(PTF x.a + PTF x.a , PTF x.b + PTF x.b , PTF x.c + PTF x.c ).a + PTF x.a , _art57793(PTF x.a + PTF x.a , PTF x.b + PTF x.b , PTF x.c + PTF x.c ).b + PTF x.b , _art57793(PTF x.a + PTF x.a , PTF x.b + PTF x.b , PTF x.c + PTF x.c ).c + PTF x.c ).a + PTF x.a , _art57793(_art57793(PTF x.a + PTF x.a , PTF x.b + PTF x.b , PTF x.c + PTF x.c ).a + PTF x.a , _art57793(PTF x.a + PTF x.a , PTF x.b + PTF x.b , PTF x.c + PTF x.c ).b + PTF x.b , _art57793(PTF x.a + PTF x.a , PTF x.b + PTF x.b , PTF x.c + PTF x.c ).c + PTF x.c ).b + PTF x.b , _art57793(_art57793(PTF x.a + PTF x.a , PTF x.b + PTF x.b , PTF x.c + PTF x.c ).a + PTF x.a , _art57793(PTF x.a + PTF x.a , PTF x.b + PTF x.b , PTF x.c + PTF x.c ).b + PTF x.b , _art57793(PTF x.a + PTF x.a , PTF x.b + PTF x.b , PTF x.c + PTF x.c ).c + PTF x.c ).c + PTF x.c ); //assign But now look what happens if we do this: fun + (var x:vec, var y:vec)=>(a=x.a + y.a, b=x.b + y.b, c=x.c + y.c); notice: VAR arguments there!! Now we get this: _i45078_v45078_x = PTF x; //init _i45079_v45079_y = PTF x; //init _i45084_v45084_x = _art57739(_i45078_v45078_x.a + _i45079_v45079_y.a , _i45078_v45078_x.b + _i45079_v45079_y.b , _i45078_v45078_x.c + _i45079_v45079_y.c ); //init _i45085_v45085_y = PTF x; //init _i45093_v45093_x = _art57739(_i45084_v45084_x.a + _i45085_v45085_y.a , _i45084_v45084_x.b + _i45085_v45085_y.b , _i45084_v45084_x.c + _i45085_v45085_y.c ); //init _i45094_v45094_y = PTF x; //init PTF y = _art57739(_i45093_v45093_x.a + _i45094_v45094_y.a , _i45093_v45093_x.b + _i45094_v45094_y.b , _i45093_v45093_x.c + _i45094_v45094_y.c ); //assign Note that I think I can fix the compiler so record slicing works the same as array slicing. Actually consider also tuple slicing (the array variant is much the same). -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials, tech docs, whitepapers, evaluation guides, and opinion stories. Check out the most recent posts - join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language