A more complete example: ////// var x = (a=1, b=2, c="m"); var y = (c=9.9, s="Hello");
typedef X = (a:int, b:int, c:string); typedef Y = (c:double, s:string); typedef XYZ = extend X, Y with (k:string) end; var xyz:XYZ = extend x,y with (k="world") end; println$ xyz.a, xyz.b, xyz.c, xyz.s, xyz.k; println$ "Felix Rocks"; ///// showing displacement of field c from x, and also the mirror image type syntax. of course those X,Y,Z types are also expressible as: interface X { a:int; b:int; c:string; } interface Y { c:double; s:string; } interface XYZ extends X,U { k:string; } which looks more Java like but means exactly the same thing. However the value extension shows that the "OO" system here is prototype object based rather than class based. BTW: here's the generated code for the merger: PTF x = _art58752(1, 2, ::std::string("m")); //assign PTF y = _art58754(9.9, ::std::string("Hello")); //assign PTF xyz = _art58755(PTF x.a, PTF x.b, PTF y.c, _art58756(::std::string("world")).k, PTF y.s); //assign Not very efficient. Unchanged by making x,y vals. The compiler isn't so good at tracking field values (it does some work tracking tuple components). [PTF means "pointer to thread frame, expands to ptf-> where ptf is a pointer to the global storage object called a "thread_frame"] -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language