JuliaInterop / JuliaInterop/JavaCall.jl
High-level interface
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 125
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
Not that I expect this issue to be resolved anytime soon, but I thought it would be nice to write down ideas to have something to start with.
In a perfect world I'd like to use JavaCall something like this:
@java foo = new Foo()
@java foo.doStuff("hello").doAnotherStuff()
@java foo.bar
Or even like this:
@java begin
foo = new Foo()
foo.doStuff("hello").doAnotherStuff()
foo.bar
end
A bit closer target may be to implement something like this (i.e. call only one method of one object):
@jcall foo.doStuff("hello")
The problem with such syntax is that it lacks several bits of required information:
jcall(foo, "doStuff", <what return type?>, (<what argument types?>,), "hello")
One way to fix issue with return type is to add them explicitly, similar to Java syntax:
@jcall JString result = foo.doStuff("hello")
Looks quite weird, but may work. However, it's still unclear how to pass argument types. Note, that jcall requires argument types from the method signature which may be parent types of actual arguments, e.g.:
jcall(foo, "doStuff", <what return type?>, (JObject,), "hello")
The best syntax that comes to mind is:
@jcall JString result = foo.doStuff("hello"::JObject)
Or a bit simpler:
@jcall JString obj.doStuff("hello"::JObject)
Another option is to use reflection to infer unknown parameters. Here we have 2 options:
- Using macros, generate code that performs reflection during run-time. Easy to implement, but reflection will slow down every call.
- Using generated functions, do all the reflection during compile-time and produce pure
jcall.
Second option looks attractive, but I have a little experience with generated functions and I'm not sure this will work.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files or tests; start by reviewing JavaCall's existing interface and the proposed @java and @jcall forms. Compare the runtime-reflection and generated-function approaches, then establish a concrete supported syntax and completion criteria before implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, julia
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100