Useage of rust in the source code #9993
Replies: 4 comments 16 replies
-
This was previously discussed in #1330 and was rejected, mainly due to concerns about buildsystem complexity. This would negatively impact the ability for new contributors to set up a toolchain and get productive quickly. |
Beta Was this translation helpful? Give feedback.
-
Mixing languages is a recipe for hard to maintain code IMO, especially having niche parts of the engine become dependent on very few maintainers We already have too many languages IMO, with:
However beyond C# all of these are platform specific and necessary (or area specific, like js for network code in websocket and webxr), and the C# is language specific, it's not used outside of that, adding another without it being necessary feels like just making things more complicated and hard to maintain, especially when it's for something that is unrelated to a specific language, like a module that isn't about a language Remember: It's not just important that the code be easy to write now but that we can maintain it in a year, or five years, or ten years, when the original contributor might no longer be available, and it must also be relatively easy to maintain it If you're knowledgeable in, for example, the way macOS works, you will also be able to use objective-c because that's what the OS API is written in, but with specific engine areas that aren't specific like that you aren't guaranteed to also know a specific language, so now you have skills that you could use to help with, for example multiplayer code, but you have to learn rust or some other language just to be able to apply that knowledge to help, that creates a barrier of entry |
Beta Was this translation helpful? Give feedback.
-
I'm sorry to say this, but as someone who uses Rust on a daily basis, I find it hard to take the proposal seriously in its current form. For a change of this scale, you need to provide a much better informed analysis than "has some nice features/libraries" and "some people prefer Rust". There is a large number of considerations you simply ignore:
I'm not writing this so that you can convince people to switch to Rust (you won't), and I'm also not saying there is no merit in the idea whatsoever. But as an advice for suggesting changes in the future, also outside Godot: this needs proper research. The larger a change, the higher the burden of proof lies on you to make sure there's merit. In particular, it's not the task of the other side to argue "why not" as long as you don't present significant reasons on "why". Hope that helps 🙂 |
Beta Was this translation helpful? Give feedback.
-
TL;DR No good reason why it should be allowed |
Beta Was this translation helpful? Give feedback.
-
Is it possible for rust code to get accepted?
And if yes, what are the requirements?
For example:
But why rust?
Ecosystem
There is a lot of code written in rust, that is also easy to add into your project.
For example, with
serde
you can easily serialize and deserializesha2
can be used to generate SHA-256 hashrayon
can be used to easily and safely parallelize codesee awesome rust for other examples
High Level
While having a low level language is great for performance.
A High level language is better for readability, and easy of use.
(Note that in most cases, we don't sacrifice any performance with rust)
For example, with enums (or unions in c++) you can do:
I am not c++ expert, so I don't know if there is a clean way to do this in c++ with variants.
Another example is unpacking
Option<T>
This can be done in c++, but I am not sure if it will be as clean as rust.
Personal preference
Some people (like me) prefer to write in rust, and are more efficient in it.
It would be nice if we can write in a language that we prefer.
But it would also be nice if you reviewed in language that you prefer.
How to review code?
To be honest, I can only think of 2 solutions.
Both of which aren't a good solution, if you don't want to learn rust
if you want to, there is rustlings which is a good starting point
How to integrate rust into c++ project?
CXX can be used for this.
Beta Was this translation helpful? Give feedback.
All reactions