Page 1 of 1
call DYNAMIC function
Posted: Tue Jan 29, 2019 4:27 pm
by SHirsch
Hi,
I am testing DYNAMIC in connection with IronPython. In C# an IronPython function can be called with the same syntax as methods.
Code: Select all
dynamic f = pyScope.GetVariable(funcName);
returnValue = f();
GetVariable returns in this case type of 'IronPython.Runtime.PythonFunction'.
In X# one has to call:
Code: Select all
LOCAL f := pyScope:GetVariable(funcName) AS DYNAMIC
returnValue := pyEngine:Operations:Invoke(f)
Calling f() throws compiler error 'XS0103: The name 'f' does not exist in current context'.
I am just asking if there is also a simple syntax. If not, it's OK.
Stefan
call DYNAMIC function
Posted: Tue Jan 29, 2019 4:56 pm
by Chris
Hi Stefan,
Please try simply "f:Invoke()", does it work? If yes, I will log it for the todo list to also support "f()".
Chris
call DYNAMIC function
Posted: Tue Jan 29, 2019 6:27 pm
by SHirsch
Hi Chris,
does not work. There is no method Invoke(). Don't care I just thought there is something I missed.
If you and Robert have an empty ToDo list, then maybe ... in year 2038 ....
Stefan
call DYNAMIC function
Posted: Tue Jan 29, 2019 6:41 pm
by Chris
Hi Stefan,
I think it shouldn't be too difficult to implement it, but we need to know what c# does in this case. From the code, it is not clear what f() really does in c#. If you had this code with strongly typed vars, what would the call to f() translate to? Do you have available documentation for the classes you are using to have a look at?
Chris
call DYNAMIC function
Posted: Wed Jan 30, 2019 7:28 am
by SHirsch
Hi Chris,
Thanks for your enthusiasm in this point but I think there are more important things do to than this one.
How about my XIDE wishes? The changed sources I sent you ( call debugger from plug-in and add items to context menus).
Regards,
Stefan
PS: I will prepare a C# and corresponding X# sample when I have more time.
call DYNAMIC function
Posted: Wed Jan 30, 2019 1:30 pm
by Chris
Hi Stefan,
Hmm, didn't I already add those a month or two ago? I thought I had informed you about this. Let me check again and will get back to you by PM.
Chris