Search code examples
frege

Searching for existing Frege java native bindings such as java.nio.file.Path


I am trying to port a simple java project over to Frege for practice. I spent a bit of time looking for bindings for java.nio.file.Path, among other things. I found https://github.com/Frege/frege/blob/master/frege/java/IO.fr, which is close, but no nio there. Next I thought I would just do it by hand or try https://github.com/Frege/frege-native-gen.

Okay, so my question is "what is the recommended way to do java bindings"? This question is not just limited to java.nio.*. More specifically, if I cannot find the bindings I want, should I

  1. Look in some standard project for them and contribute my own if I cannot find them?
  2. Use the generation tool to create my own?
  3. Do something else not mentioned here?

Solution

  • This would depend on the situation. For example, it is often the case that you can get your project going with 2 or 3 native definitions.

    OTOH, contributing a new module with Java SDK bindings is most welcome. But note that it's not always trivial, since the native gen tool most often creates code that needs close examination and manual improvement.

    The rule is that the Java SDK should be supported out of the box (it isn't yet as you've discovered). For other libraries there may be existing projects it is worth looking for.