You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This function executes a method of a Java object, given the object on which to call the method and the arguments of the method, and it yields the result, which this particular function expects to be a reference. There is one function like this per possible return type.
The list of arguments can contain either primitive values or references to java objects (JObject). And we would like to ensure that these references are deleted when no longer needed.
The current approach in the interface based on linear types, is to have callObjectMethod destroy the references passed as arguments after the result is obtained.
We return both the result and a reference to the object on which the method was invoked. Only the references in the arguments of the method are destroyed.
Now, how would we cast this example with linear constraints? Unlike the current approach, here I'm aiming to keep alive all given references after the call.
Or maybe we should expand our many functions callObjectMethod, callIntMethod, callDoubleMethod, etc, to offer variants for the most common method arities:
callObjectMethodUnary, callObjectMethodBinary, callObjectMethod3, ...
The text was updated successfully, but these errors were encountered:
facundominguez
changed the title
Discuss how to use linear constraints with variable amount of linear arguments
Discuss how to use linear constraints with a variable amount of linear arguments
Nov 2, 2019
The jni package has functions like:
This function executes a method of a Java object, given the object on which to call the method and the arguments of the method, and it yields the result, which this particular function expects to be a reference. There is one function like this per possible return type.
The list of arguments can contain either primitive values or references to java objects (
JObject
). And we would like to ensure that these references are deleted when no longer needed.The current approach in the interface based on linear types, is to have
callObjectMethod
destroy the references passed as arguments after the result is obtained.We return both the result and a reference to the object on which the method was invoked. Only the references in the arguments of the method are destroyed.
Now, how would we cast this example with linear constraints? Unlike the current approach, here I'm aiming to keep alive all given references after the call.
Or maybe we should expand our many functions callObjectMethod, callIntMethod, callDoubleMethod, etc, to offer variants for the most common method arities:
callObjectMethodUnary, callObjectMethodBinary, callObjectMethod3, ...
The text was updated successfully, but these errors were encountered: