1. Re: foperator overloading (was Re:fraclib.e)
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jan 22, 2003
- 402 views
Someone, I forget who, wrote: >> BTW, what would be really useful here, is a way to make a custom type >> which allows one to redefine the math operators, so I could do "f1 + = f2" >> rather than "f_add(f1, f2)", but have the 2 mean the same thing. Interesting. The syntax should(could) be something as trivial as: include custom_type_redefine.e -- global redefine() function f_add(blah, blah, blah end function -- <no difference to normal yet> type ftype(blah... redefine("+","f_add") ... end type ... ... .. Somehow I realise there is true potential here, but a convincing example escapes me (hint, hint) Pete PS as "+" is both a unary and binary operator, you might have to redefine({"+",2},{"f_add",2}). Other stuff too.