On Mon Nov 05 14:27:29 2012, jn...@jnthn.net wrote: > On Wed Apr 04 04:10:55 2012, masak wrote: > > <colomon> r: say 4 < 5 < 6 < 7 > > <p6eval> rakudo 4373f0: OUTPUT«True» > > <colomon> r: say 4 < 5 < 6 < 4 > > <p6eval> rakudo 4373f0: OUTPUT«False» > > <masak> r: enum A <e1 e2 e3>; multi infix:<< < >>(A, A) { False }; > > multi infix:<< < >>(e1, e2) { True }; multi infix:<< < >>(e2, e3) { > > True }; multi infix:<< < >>(e3, e1) { True }; say e1 < e2 < e3 < e1 > > <p6eval> rakudo 4373f0: OUTPUT«False» > > <masak> aww :) > > <masak> why doesn't the above work? > > <tadzik> masak: doesn't it? > > <masak> no. read carefully what it does. > > <tadzik> oh, right, it doesn't > > <masak> r: enum A <e1 e2 e3>; multi infix:<< < >>(e1, e2) { True }; > > say e1 < e2 > > <p6eval> rakudo 4373f0: OUTPUT«True» > > <masak> r: enum A <e1 e2 e3>; multi infix:<< < >>(e3, e1) { True }; > > say e3 < e1 > > <p6eval> rakudo 4373f0: OUTPUT«False» > > <masak> there we go. > > <masak> that's the bit that's failing. > > <tadzik> r: enum A <e1 e2 e3>; multi infix:<< < >>(A, A) { False }; > > multi infix:<< < >>(e1, e2) { True }; multi infix:<< < >>(e2, e3) { > > True }; multi infix:<< < >>(e3, e1) { die "LOL"; True }; say e1 < e2 > > < e3 < e1 > > <p6eval> rakudo 4373f0: OUTPUT«False» > > <tadzik> yep > > <masak> right. > > <masak> it's never run at all. > > <masak> r: enum A <e1 e2>; sub foo(e1) { die "MATCHED" }; foo e1 > > <p6eval> rakudo 4373f0: OUTPUT«MATCHED in sub foo at > > /tmp/E03yKbC5Z_:1 in block <anon> at /tmp/E03yKbC5Z_:1» > > <masak> seems to be related to operators, then. > > <tadzik> r: enum A <e1>; multi prefix:<->(e1) { die "AWW" }; say -e1 > > <p6eval> rakudo 4373f0: OUTPUT«AWW in sub prefix:<-> at > > /tmp/LdnFrauMSw:1 in block <anon> at /tmp/LdnFrauMSw:1» > > <colomon> r: enum A <e1 e2 e3>; multi infix:<< < >>(e1, e2) { say > > "hello!" }; say e1 < e2 > > <p6eval> rakudo 4373f0: OUTPUT«True» > > <tadzik> r: enum A <e1 e2>; multi infix:<->(e1, e2) { die "AWW" }; say > > e1 - e2 > > <p6eval> rakudo 4373f0: OUTPUT«AWW in sub infix:<-> at > > /tmp/tvYdwSv0aA:1 in block <anon> at /tmp/tvYdwSv0aA:1» > > <tadzik> hmm > > <colomon> r: enum A <e1 e2 e3>; multi infix:<< < >>(A, A) { say > > "hello!" }; say e1 < e2 > > <p6eval> rakudo 4373f0: OUTPUT«True» > > <colomon> r: enum A <e1 e2>; multi infix:<< - >>(e1, e2) { die "AWW" > > }; say e1 - e2 > > <p6eval> rakudo 4373f0: OUTPUT«-1» > > <colomon> think that's your problem > > <colomon> r: enum A <e1 e2 e3>; multi infix:«<»(A, A) { say "hello!" > > }; say e1 < e2 > > <p6eval> rakudo 4373f0: OUTPUT«hello!True» > > <colomon> yup > > * masak submits rakudobug > > <masak> tadzik++ colomon++ # golfing > > > > Note particularly that the third-last evaluation (with multi infix:<< > > < >>) doesn't work as intended, whereas the last one (with multi > > infix:«<») does. > > Works these days: > > > enum A <e1 e2>; multi infix:<< - >>(e1, e2) { die "AWW" }; say e1 - e2 > AWW > > Tagging testneeded. > > /jnthn >
Added new test file, S03-operators/custom.t -- Will "Coke" Coleda