Open matan-h opened 6 months ago
Overload resolution is currently only based on the top-level type of the argument, not its value. It would be quite difficult to change this.
However, I agree the syntax could be improved (#1058).
While I truly believe the syntax can be improved, this issue is more towards running kivy
code in chaquopy. pyjnius
library (e.g. from pyjnius import ...
is quite straightforward to convert to from java import ...
.)
However, this implementation difference it what preventing kivy
code (without the kivy library, such as kvdroid
), to archive 95% functionality with chaquopy
.
For demonstration proposes, I've created a way to run libraries written in Pyjnius
. It's effectively the Pyjnius
functions written using chaquopy java
module.
this library work for almost (~90%) all functions in plyer and kvdroid.tools that does not need list<->jarray
conversion.
Most jcontainer->list
cases (#1048) solved by simply adding the cross-framework function : .toArray
.
However, to solve the cases of list->jarray
I'll need to add the chaquopy-spesific function jarray(type)(array)
.
I'm open to the idea of looking at the content of a list in situations like this, but it would be a complex change. The starting point would be the current implementation of the overload resolution algorithm.
Related:
I want to execute this code (which fine work in kivy):
and I get this error:
and the
jarray
method is feeling like it just complicates the code and greatly affects the ease of use:Can
chaquopy
detect if a list has onlystr
or onlyint
and convert it?