-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clojure support #242
Comments
Not to derail the issue, but I think clojure (or any other JVM language) support does not belong in this repo as this focuses more on Kotlin/JVM side of things. The glue code (C++) in this repo can be extracted so that it can be re-usable by other JVM languages - but it will incur an additional maintenance burden. |
So first I have to explain a bit how our repo works so you can understand what to do. The C++ part of the code is the actual module we compile Godot with. What it does conceptually is simple. It implements the Godot Script API so it can communicate with a JVM. It defines a protocol so both C++ and JVM can exchange Godot-related Data. Then the Kotlin code comes. It contains several tools to generate Kotlin code and plugins to help the compilation but the biggest part is the Godot Library. We reimplemented the Godot core types (Vector2, AABB, Array, etc..) and generated wrappers around all the different objects in the Godot API. That library is what you import when you want to create a Kotlin Script for Godot, you just inherit one of the wrappers and override/add properties and method to it. Now how does this work in action? When you write and build a Kotlin Script, a Kotlin entry file is generated. This is a special file that the C++ module will execute at the start of the engine using its ability to communicate with the JVM. Now how to implement a new language on top of that? I'm confident that most part of the code can be reused as it is (like 80/90%). The Godot Library can be reused simply because you can use the Kotlin library from other JVM languages (How boilerplate this depends on the language itself so it's outside our control). And the ability for the C++ code to communicate is almost agnostic to the JVM language used. On the C++ side, the main work would be to create an additional file so it can map .clj (I think it's that one ?) files to properties/method just like it already does from Kotlin.
and maybe make https://github.com/utopia-rise/godot-kotlin-jvm/blob/master/src/gd_kotlin.h a bit more generic? On the JVM side, like I said the library can be reused if you interop with Kotlin code from Clojure. Creating your own Clojure wrappers is also possible but it's way more works as you would need to rewrite yourself all the Kotlin code in Clojure which I don't recommend. No, the biggest challenge would be to create the EntryFile I told you about. This time it's not a few files you have to adapt like C++ but this whole directory. It contains the code to generate the entry file + extra plugin for the Kotlin compilator so the code source can be analyzed during a build using annotations. This basically sums up the explanation. Of course, some other parts of the repo won't work anymore like the IDEA plugin for the Godot Kotlin Script because they are obviously made to work with Kotlin itself. I won't talk about those things as I really don't get how they work (Far from the part I'm responsible for) and they are not necessary for the projects to run anyway, it's just QOL tools. When it comes to the stand of our 4 maintainers. We won't help with such an extension to the repo, at least for a while because we want to make Kotlin the priority and first debug/optimize what can be the base for other languages. But we are always willing to explain stuff to potential contributors so they can understand how the repo works. Unlike Ranie, I don't think it has to necessarily go into another repo. Probably the extra Clojure/other JVM language tools and entry generator will have their own repo yes. |
On my side I do agree with @CedNaru |
Additional statement: Given the major rework going on with Godot extension system currently: A good chunk of the C++ code will probably have to be reworked when we switch to 4.0. Most likely the whole Scripting API will be abandoned in favor of that new extension system. So be careful to not start working on something that could not make it to 4.0. |
Closing as we now support Java and designed the entry generator to be easily have third party language support. But we have no intention of supporting officially other JVM languages for maintainability reasons. We leave the door open for contributors that would wish to do it themselves. |
Hi everyone,
I was wondering what would be necessary to help get Clojure working on Godot? I'd love to get started on trying to get it working!
The text was updated successfully, but these errors were encountered: