5 ms·
http://mmhelloworld.github.io/blog/2013/07/10/frege-hello-java/ http://mmhelloworld.github.io/blog/2013/07/10/frege-hello-ja... Am I correct in thinking that F
by devty 11y ago
http://mmhelloworld.github.io/blog/2013/07/10/frege-hello-java/ http://mmhelloworld.github.io/blog/2013/07/10/frege-hello-ja...
Am I correct in thinking that Frege cannot leverage on third-party java libraries? Clojure, another functional language built on JVM, has great support for this (possibly) missing feature.
- maaku 11y agoI don't know about Frege, by why wouldn't it? Being able to call out over FFI or the Java equivalent is a pretty standard feature.
- voxfrege 11y agoNo, incorrect. You can use any existing bytecode, whether it was produced by Java or anything else.
- jmillikan 11y agoCalling Java from frege isn't hard, but there isn't currently a way to directly implement interfaces or inherit abstract classes in just frege. You can create a sort of proxy in Java (or whatever) and implement methods in frege, but it's not pretty. (I think; I haven't quite comprehended the examples.) The article at https://mmhelloworld.github.io/blog/2013/07/10/frege-hello-java/ https://mmhelloworld.github.io/blog/2013/07/10/frege-hello-j... talks about this, but doesn't quite explain the proxy mechanism, it just points out an example.
- voxfrege 11y ago> but there isn't currently a way to directly implement interfaces or inherit abstract classes in just frege. Not quite true anymore. TO be sure, some (inline) java will still be needed. Here is an example https://github.com/Frege/frege/blob/master/tests/comp/Issue20.fr https://github.com/Frege/frege/blob/master/tests/comp/Issue2... which compiles to a class that implements java.util.Comparator. Instances thereof can be created from Frege by passing a custom comparision function and could be passed to Java. The example would be useful in cases when you have Frege data in a Java collection and want to sort them. But it is merely there to show the possibilities.