I am thinking of using Frege in a Java project. I need that the compiler generates plain Java source files, not class files. -- I looked at the Frege wiki, but could not determine whether this is the case.
Asked
Active
Viewed 44 times
0
-
Why do you need to generate source files? – Olivier Aug 16 '22 at 07:30
-
@Olivier I want to be independent of class files. The generated Java files will get checked in into CVS. – halloleo Aug 16 '22 at 07:32
-
Well, the page you linked says "This code will compile to Hello.class and Hello.java". – Olivier Aug 16 '22 at 07:34
-
The other way to determine what it does is to look at the source code of Frege itself. – Stephen C Aug 16 '22 at 07:39
-
@Olivier Yes, that's exactly the unclear part: Is the hello.java complete or does it need a additional hello.class file? I would like input from Frege users here. – halloleo Aug 16 '22 at 07:39
-
1It would make little sense to generate a .java source that is not compilable. Anyway, you should just do a test yourself and see what you get exactly, instead of waiting for "Frege users" who will probably never come (the previous question with the `frege` tag was asked in 2019!). – Olivier Aug 16 '22 at 07:46
-
@StephenC Agreed - and question updated. (As an aside: Do you know a Stack Exchange site for these open "Bonus" questions like "Other FPLs transpiling to Java source files"?) – halloleo Aug 16 '22 at 07:52
-
1Looking at the code, I see code to generate `.java` files and to call `javac` programatically. I don't see code (or dependencies) to generate bytecodes directly. – Stephen C Aug 16 '22 at 07:52
-
1Well I don't think your bonus question was a good question for StackOverflow. It is a borderline "find me a resource" question. And I don't think it was a good fit for Software Recommendations either. So basically, no I don't know of one. – Stephen C Aug 16 '22 at 08:02
-
what do you mean: does it "need" a .class file? Do you understand the relationship between a .java and a .class file? – Stultuske Aug 16 '22 at 08:06
-
@Stultuske I think I generally do, but I was not sure whether in this case the class file is really a direct compilation of the java file (I thought: Maybe Java has stub source files?). -- Anyway, after [Stephen C's extremely helpful comment about what Frege *does*](https://stackoverflow.com/questions/73370197/does-frege-transpiles-directly-to-java-source-code#comment129572318_73370197), I'm pretty confident that the source file is all what there is to it. – halloleo Aug 16 '22 at 11:45
-
BTW, @StephenC, thanks for [your convincing comment](https://stackoverflow.com/questions/73370197/does-frege-transpiles-directly-to-java-source-code#comment129572318_73370197). Would make a reasonable answer, I think. – halloleo Aug 16 '22 at 11:48
-
@halloleo Why do you want to save generated code to git? That's exactly what people try to avoid by versioning the source for the generation instead of generated sources. Normally you should version your code, i.e. your work, instead of some intermediate product which is likely to be of different standards than rest of your code. – Rostislav Matl Oct 20 '22 at 09:31