Anonymous Login
2018-12-16 11:02 UTC

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0001836OpenClonkEngine - C4Scriptpublic2017-08-20 11:58
ReporterLuchs 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
Product Version 
Target Version9.0Fixed in Version 
Summary0001836: Inconsistent function binding in proplists
DescriptionInside 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 Informationstatic 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"
}
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes
There are no notes attached to this issue.
+Notes

-Issue History
Date Modified Username Field Change
2016-10-30 11:35 Luchs New Issue
2017-08-05 13:58 Maikel Target Version => 8.0
2017-08-20 11:58 Zapper Target Version 8.0 => 9.0
+Issue History