Indeed. A test script: #!/usr/local/bin/pike -rt
class T(string t) { T `+=(string s) { werror("calling T->`+=(%O)\n", s); t += s; return this; }
T `+(string...args) { werror("calling T->`+(%s)\n", sprintf("%O",args[*])*","); return T(t + predef::`+(@args) ); } }
int main() { T o = T("bar"); T p = o; o += "foo"; write("o->t == %s\n", o->t); write("p->t == %s\n", p->t); return 0; }
Under 7.4.13 it prints calling T->`+("foo") o->t == barfoo p->t == bar
/ rjb
Previous text:
2003-04-17 21:23: Subject: lfun::`+=()
Either I totally failed to understand how it's supposed to work, or these lfuns are quite non-functional:
class T(string t){ T `+=(string s){ t+=s;return this; } } T o = T(""); o->t;
(7) Result: ""
o+="bar";
Incompatible types Unknown program: `+(HilfeInput()->T(),"bar")
Obviously Pike is calling `+(o, "bar"), and ignoring the existence of lfun::`+=() in T...
/ rjb