LOL. i am trying this: instance [U, V with Str[U]] Str[U ** V] { fun str (x: U ** V) => match x with | ?a ,, ?b => str a +", " + str b endmatch ; } /* instance[T,U] Str[T*U] { fun str (t:T, u:U) => "("+str t + ", " + str u+")"; } */
Somehow this breaks my test program (I get an overload error in C++ for an assignment). Strangely enough Felix builds and some tests seem to work .. some not: Cannot find type double * string^2 in registry Error 1 in flx: Operation not permitted * build/release/bin/flx --test=build/release: build/release/test/regress/rt/objects-01.flx -> build/release/test/regress/rt/objects-01 This works tho: var x = 1,2.3, "Hello", 1,2.3, "Hello", 1,2.3, "Hello", 1,2.3, "Hello", 1,2.3, "Hello", 1,2.3, "Hello", 1,2.3, "Hello" ; println$ x; But in any case there's a problem! The tuple cons instance using ** doesn't put the parens in! It's not cool, because (1,("2",3.3)) will print as 1,2,3.3 which is wrong. Its not possible for this routine to put in the parens because it calls itself on the tail which would make a "(" before every element. The workaround is the usual one in all computer science: if you can't make the dang thing work, KICK IT. That doesn't fix anything, but it makes you feel better. Then, try indirection :) We need Str [U **V] to call InnerStr[U ** V] which has function inner_str which defaults to str, but is specialised on U ** V to produce the comma list, whilst the outer Str:: str instance just puts in the parens. -- 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