some thoughts on panama/jextract
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Wed Jan 8 11:15:29 UTC 2020
On 08/01/2020 10:01, Samuel Audet wrote:
> The Java API that gets created for all these platforms is exactly the
> same, and it works exactly the same on all these platforms as well.
> That's the kind of thing the Java community needs, in my opinion.
I agree that, as a user, the best case is to just download some Maven
artifact that gives me the library I want (if it exists!!!!!) - no
matter which platform I'm on, and have a single javadoc to go through to
learn the API.
As we discussed on this thread, depending on the choices made by the
API, this can sometimes be easy or hard to achieve. If a library creates
portable type definitions, so that the layouts remain the same across
platforms - or stays away from ambiguous types such as 'long' (which on
Windows mean something else), then having a single API is indeed possible.
If the API is really ill-behaved, there are choices to be made. One
platform could have more functions than another platform - what do you
do? Or, some struct layouts might be completely incompatible (e.g. a
struct in a platform has 3 fields and in another has 4). If you have
these issues, no matter what tool you use to generate the Java bindings
- you _have_ to make choices about what to do, and how to paper over the
differences.
It is not Panama's job to tell you how to do that (paper over the
differences) - I can imagine frameworks much more sophisticated (and
higher level) applying various heuristics in order to try and compress
all the extracted bindings into a uniform API.
Maurizio
More information about the panama-dev
mailing list