Git Product home page Git Product logo

Comments (5)

aviks avatar aviks commented on August 20, 2024

So when I had thought about this earlier, my idea was to use reflection (and some heuristics) to infer the argument types (and thus the exact method), but then cache the results of the reflection. In my experience, most java code that use reflection heavily always cache the results, given how slow it is. So that could be one option. I believe that is how the python-java interface works.

I'll have a think about the syntax. My criteria are somewhat contradictory, to reduce the cognitive overhead for both the java and the julia developer.

from javacall.jl.

dfdx avatar dfdx commented on August 20, 2024

Caching results from reflection API sounds promising! I also have some progress on a generated functions approach in high-level-macro branch, but still not sure this will work well in practice.

from javacall.jl.

kcajf avatar kcajf commented on August 20, 2024

Could the dot syntax / auto-completion be handled by the getfield and fieldnames methods added in Julia 1.0?

from javacall.jl.

aviks avatar aviks commented on August 20, 2024

Yes, that's the idea. It's just that we've not had the time to implement this.

from javacall.jl.

mkitti avatar mkitti commented on August 20, 2024

I wanted to propose a roadmap for this since there are multiple proposals on the table.

My vision for the JavaCall package is to provide a solid foundation that takes care of most of the low level interface of the JNI and provides a Julian method of calling Java. We should be able to do a few things like inferring or automatically importing the return type.

For some of the examples above, I would like to point out that the below is not really Java. You could not compile that with javac.

@java begin
    foo = new Foo()
    foo.doStuff("hello").doAnotherStuff()
    foo.bar
end

It would be closer to something like Groovy. My proposal to support that would be a GroovyCall.jl package which would depend on JavaCall.jl. In that case, we let Groovy handle the syntax parsing.

What to expect:

  1. Limited support in JavaCall.jl to make calling Java methods easier. It is reasonable to infer the return type given the argument types, for example.
  2. A series of packages built upon JavaCall.jl that supports higher level syntax via Groovy, etc.

from javacall.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.