View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0001836 | OpenClonk | Engine - C4Script | public | 2016-10-30 11:35 | 2017-08-20 11:58 | ||||||||
Reporter | Luchs | ||||||||||||
Assigned To | |||||||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||||||
Status | new | Resolution | open | ||||||||||
Product Version | |||||||||||||
Target Version | 9.0 | Fixed in Version | |||||||||||
Summary | 0001836: Inconsistent function binding in proplists | ||||||||||||
Description | Inside a proplist function, when calling another function in the same proplist, the call is bound statically and does not depend on the value of "this" during runtime. However, references to the function are always resolved at runtime using the current "this" value. Consequently, a call foo() is not equivalent to Call(foo) which is confusing. There's an example below which illustrates the issue. A real-world example is trying to use ScheduleCall() instead of Call(). | ||||||||||||
Additional Information | static const Functions = { Fun1 = func() { Log("Fun1"); Fun2("direct call"); // always works Call(Functions.Fun2, "Call(Function.Fun2)"); // always works Call(Fun2, "Call(Fun2)"); // doesn't work, should be equivalent to direct call this->Fun2("call on this"); // doesn't work, okay Call(this.Fun2, "Call(this.Fun2)"); // doesn't work, okay }, Fun2 = func(string how) { Log("Fun2: %s", how); }, }; func Main() { Functions->Fun1(); Call(Functions.Fun1); // call with different "this" } | ||||||||||||
Tags | No tags attached. | ||||||||||||
Attached Files |
|