Hi, I am one of the contributors of IntelliJ IDEA plugin.
I am currently developing the launch of Frege code inside IDEA, including build system and interpreter support.
We have some build system already, and it is based on Gradle. I have found some build.gradle here and modified it for our purposes.
We currently do not have proper support for complicated projects, which contain both frege and java files with difficult dependencies. For example, we don't support projects with dependencies like Java -> Frege -> Java or Frege -> Java -> Frege.
Meanwhile, I am not sure if such projects need to be supported at all, and wondered to ask about it.
Also I am about to start developing interpreter support. We plan to support a command-line execution inside IDEA's terminal, and also an execution of an arbitrary part of code by click.
I think that I understand, how to implement the command-line execution, but I am not sure about the execution of arbitrary code.
it would be very useful if you could point, what methods I should call in compiler to launch an arbitrary part of code and get the result of execution.
Thank in advance!
@Dierk Thanks for the provided examples of REPLs and Frege wiki reference, I will examine it!
I also examined FregeFX source code. As far as I understand, Java code uses Frege compiler's classes, and vice versa, Frege code uses JavaFX. But as I understand, both Frege compiler and JavaFX contains already compiled .class files, that are used to build the project.
I meant the situation when the project contains, for example, a dependency like this:
File1.fr -> File2.java -> Fiel3.fr
Then the compilation need to be executed in the order C.fr, then B.java, then A.fr, to satisfy dependencies. But Frege compiler does not automatically resolve such dependencies, so I have to resolve them by hand, compiling in the right order.
Here is the example of such project: https://gist.github.com/23jura23/b9e40c6d7d7a98c6684edf4c879f820b
Another problem is the cyclic dependency, like this:
File1.fr <-> File2.java
Here is the example of such project: https://gist.github.com/23jura23/58ce0c73bd7a47015db3a6f908d3d2d6
Although the first project could be built, the second one could not be built at all. This happens because File2.java uses .class file, i.e. File1.class, and File1.class is not created until File1.fr is built. And File1.fr could not be built, because File2.java does not find File1.class.
I am not sure if these problems have solutions at all, or I just failed to find them.
@Dierk Thank you!
As I understand, as plugin developers we need to provide support for Java inline, and we'll examine what we can do with it.
And as possible future Frege developer, I appreciate solutions you provided
Writing the whole plugin in Frege sounds like a very ambitious task that we are not ready for yet :-)
Globalfor type inference. As we understand,
Globalis the result of parsing of the whole file. So there is a question: can we incrementally keep
Globalupdated? I mean: if an user changes a small part of file, can we get an actual
Globalwithout re-parsing the whole file? If so, could you, please, give us a hint how to do it or where we can see an example of that.
Globalis that we build a PSI tree and resolve all references on our own. As we understand, if we use
Global, the compiler will do it one more time. Can we reuse PSI trees and references somehow?
Globalin the way you mentioned. There is a more flexible (yet arguably less sophisticated) way to deal with this issue: one can use the
Interpreterjust like the REPLs do: https://github.com/Frege/frege-repl/blob/5701b6bbce25662b1ce172dd677a6fe2e058a885/frege-repl-core/src/main/frege/frege/repl/FregeRepl.fr#L556 . This allows to pass arbitrary strings for inspection (:type, :browse, etc.). That means that if you can partition the file into pieces that would compile separately, you can pass them into the Interpreter for inspection. In fact, that somehow mimics my working style when programming Frege where I have the REPL running, load my current file, reload on changes, and work with the REPL for compiler feedback and type information ;-)