What happens when you import an library written in another language, and one of the functions is a reserved keyword in your language?
This is already possible in Rust. You can import libraries written with different editions, and there are different reserved keywords across editions.
The compiler just looks at what language the library was written in and switches internally based on that.
In my C and C++ example, you'd pass different flags for that library during build time, although I'm not sure how this would work for header-only libraries.
Edit: I see your reserved keywords example is an issue, and I raise you raw identifiers (r#if in Rust, @if in C#, etc)
How would collaboration between people with different native languages work?
Same way it currently does? It's not like everyone who writes code knows English, but somehow they can all write it despite the keywords being in English.
Who makes sure all language variant have equally good educational resources?
The community around that programming language would be responsible for this, would it not? This is already a thing people do, though it's impossible to translate all educational resources that exist into all languages. Fortunately we have services that can translate things for us though.
There's a reason why lingua francas change over time but always exist, and forgetting that will do more harm than good.
It would do no harm here. People already write code in many languages. In most popular programming languages, you can already name things in Korean, French, Russian, and so on. Documentation for the languages exist already in all those languages. There is literally only one thing that would change: the keywords. It's really not that complicated.
You have a few options here, but the easiest is to collect into a
Vec<char>, replace the character there, then do aString::from_iter(chars)to get it back as a string.You can also manipulate the original chars iterator directly through takes, skips, and so on and
collectit into a string, but that's more complicated.Also, "character" is such a complicated concept because unicode is not simple. If you can work directly with bytes though, you can convert the string to a
Vec<u8>(which is the underlying type forString), manipulate that directly, then doString::from_utf8(or the same method forstr) to convert it back to a string.