Is it not good to have
or as logical operator as the option against
|| like Python C++ Java and other popular languages?
Its very annoying to type those chars while coding!
Is it not good to have
Correct me if I'm wrong, but don't 2 out of the 3 other languages you listed also use
|| instead of
Changes that would break existing Rust code are non-starters. Even in an edition, changes this fundamental remain extremely unlikely. The established Rust community with knowledge of existing Rust syntax has a great deal of value, and to be considered, a syntax change proposal would have to be not just better, but so wildly better as to overcome the massive downside of switching.
C++ allows using
or. And C allows it when including "iso646.h": C alternative tokens - Wikipedia I have never seen anyone use it in the wild though.
Yeah, they’re mostly there to support obscure legacy platforms with incredibly constrained charsets.
I never told to change but keep the alternative against && and ||
Sorry, turns out I didn’t quote the most relevant paragraph from the page I’ve linked:
Fundamental changes to Rust syntax
This includes proposals such as changing the generic syntax to not use
>, changing block constructs to not require braces, changing function calls to not require parentheses, and many other similar proposals. These also include proposals to add "alternative" syntaxes, in addition to those that replace the existing syntax. Many of these proposals come from people who also write other languages. Arguments range from the ergonomic ("I don't want to type this") to the aesthetic ("I don't like how this looks").
In order to give an even more complete picture of what that page is “Frequently Requested Changes” about from my quotations alone, let me also quote the first paragraphs:
Some ideas for language proposals come up quite often. They're attractive ideas for one reason or another, but ones that we're unlikely to add.
This page documents some of those ideas, along with the concerns that argue against them.
If something appears on this page, that doesn't mean Rust would never consider making any similar change. It does mean that any hypothetical successful proposal to do so would need to address at a minimum all of these known concerns, whether by proposing a new and previously unseen approach that avoids all the concerns, or by making an extraordinary case for why their proposal outweighs those concerns.
In particular, there's a concept of "decision paralysis" or "choice paralysis", where giving people more than one way to do something leads people to wonder if there's a difference, wonder which one they should choose, wonder if they're doing it right...
It's possible for us to expend the effort to teach people "this means exactly the same thing, you can use either one, don't worry", and it's possible for us to make new names for methods currently named
or and make people use things like
r#or to refer to the old names. That is a very high bar, where something would have to be an incredibly important concept in the language for us to even consider it.
It's not something we'd consider for aesthetic purposes. Especially for subjective aesthetic purposes, because whether
and is better than
&& is definitely subjective; when you're reading
complex_thing && another_thing && yet_another_thing, sometimes it's nice that the operators don't look like words and thus stand out.
Now, that said, you said "it's very annoying to type those chars". Do you have a locale / keyboard layout in which those characters are a pain to access (e.g. requiring you to press AltGr and/or press multiple keys, not just a simple Shift+key?) ? In that case, you might consider teaching your editor to treat
or (with a space before it and/or no parenthesis after it) as abbreviations for
||, respectively, or a similar mechanism to make them easier to type. Many editors make this easy to do.
You might also check if your locale has an alternate keyboard layout that's designed for programming. Some locales have a layout for everyday typing and a layout for programming, where the latter makes some symbols easier to type.
Java does not support