What about adding keyword forms for some operator symbols, like in C++ ?
Symbol | Keyword
----------------
! | not
!= | noteq
|
&& | and
|| | or
|
& | bitand
| | bitor
Thread overview | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 25 [Feature Request] Keywords for symbol operators | ||||
---|---|---|---|---|
| ||||
What about adding keyword forms for some operator symbols, like in C++ ?
|
February 25 Re: [Feature Request] Keywords for symbol operators | ||||
---|---|---|---|---|
| ||||
Posted in reply to Danilo | Programming languages are evolving, like evolution is evolving. In 2024 it‘s probably better to support alternative keywords Writing clear code using the english language is better |
February 25 Re: [Feature Request] Keywords for symbol operators | ||||
---|---|---|---|---|
| ||||
Posted in reply to Danilo | On Sunday, 25 February 2024 at 07:42:16 UTC, Danilo wrote: >Programming languages are evolving, like evolution is evolving. In 2024 it‘s probably better to support alternative keywords Writing clear code using the english language is better Quite easy to break existing code in this way. And we're going to add more keywords and "noise". Andrea |
February 25 Re: [Feature Request] Keywords for symbol operators | ||||
---|---|---|---|---|
| ||||
Posted in reply to Danilo | On Sunday, 25 February 2024 at 04:55:08 UTC, Danilo wrote: >What about adding keyword forms for some operator symbols, like in C++ ?
Would love to have that. C++ has not, and, and or for a while as keywords. |
February 25 Re: [Feature Request] Keywords for symbol operators | ||||
---|---|---|---|---|
| ||||
Posted in reply to Danilo | On Sunday, 25 February 2024 at 07:42:16 UTC, Danilo wrote:
> Writing clear code using the english language is better
> than using cryptic symbols, in modern times.
PHP has `and` and `or` (and `xor`) keyword operators and I don’t think anyone is really using them.
People usually go with the symbols instead.
Regarding the “cryptic symbols” claim:
Propositional calculus in math uses symbols, too.
|
February 25 Re: [Feature Request] Keywords for symbol operators | ||||
---|---|---|---|---|
| ||||
Posted in reply to Danilo | On Sunday, 25 February 2024 at 04:55:08 UTC, Danilo wrote: >What about adding keyword forms for some operator symbols, like in C++ ?
whats the name of |
February 25 Re: [Feature Request] Keywords for symbol operators | ||||
---|---|---|---|---|
| ||||
Posted in reply to monkyyy | On Sun, Feb 25, 2024 at 08:13:40PM +0000, monkyyy via Digitalmars-d wrote: > On Sunday, 25 February 2024 at 04:55:08 UTC, Danilo wrote: > > What about adding [keyword > > forms](https://en.cppreference.com/w/cpp/language/operator_alternative) > > for some operator symbols, like in > > [C++](https://en.cppreference.com/w/cpp/language/operator_logical) ? > > > > ``` > > Symbol | Keyword > > ---------------- > > ! | not > > != | noteq > > | > > && | and > > || | or > > | > > & | bitand > > | | bitor > > ``` > > whats the name of `foo["bar",1..5]*=Seq!(13.37,'a');` ```d foo openSquareBracket openDoubleQuote bar closeDoubleQuote comma 1 doubleDot 5 closeSquareBracket multiplyAssign Seq templateArguments openParenthesis 13.37 comma openSingleQuote a closeSingleQuote closeParenthesis semicolon ``` See? Way more readable than the current cryptic syntax. ;-) T -- I am not young enough to know everything. -- Oscar Wilde |
February 25 Re: [Feature Request] Keywords for symbol operators | ||||
---|---|---|---|---|
| ||||
Posted in reply to Guillaume Piolat | On Sunday, 25 February 2024 at 15:24:40 UTC, Guillaume Piolat wrote: >Would love to have that. C++ has not, and, and or for a while as keywords. Exactly! Just discovered C++ has keywords 'and'/'or'/'not' etc. I've been using Hundred percent. It’s so much more readable to write “not” before a variable in an if statement... I think it’s annoyingly easy to read over the ! in (!longvariablename). Modern C++ : Personally I read about it in C++20/23 books round about 2 years ago for updating my C++98 knowledge, and then just started using it. Takes 1-2 days for getting used to it. ;) |
February 26 Re: [Feature Request] Keywords for symbol operators | ||||
---|---|---|---|---|
| ||||
Posted in reply to Danilo | On Sunday, 25 February 2024 at 23:40:19 UTC, Danilo wrote: >Personally I read about it in C++20/23 books round about 2 years ago for updating my C++98 knowledge, and then just started using it. Takes 1-2 days for getting used to it. ;) Adding new ways to do the same is a bad idea. If you want to create a new language (in this case: using english instead of math symbols), stick to it and don't mix it with the old language. This of course doesn't apply if you have a new concept not available in a language. Then using a term from another language that better describe it is ok - that's the way languages evolve. But simply adding a new word for the same thing is only useful if you explicitly don't want everybody to understand you. E.g. every new generation invents new words for the same concepts, just to be not understood by their parents. Or some "experts" invent a lot of special terms to not be understood by "ordinary" people. So if you want to create some elite kind of D, do it on your own fork and don't call it D anymore. |
February 26 Re: [Feature Request] Keywords for symbol operators | ||||
---|---|---|---|---|
| ||||
Posted in reply to Danilo | On Sunday, 25 February 2024 at 07:42:16 UTC, Danilo wrote: >Programming languages are evolving, like evolution is evolving. In 2024 it‘s probably better to support alternative keywords Writing clear code using the english language is better I don't consider this an evolution of programming languages. FORTRAN 66 was the first language to have an ANSI standard, and it included these operators, so it's more a recognition that the old guys did it right. COBOL also had them back at least to COBOL 68, (its first standard). Later languages like Lua and Perl have them too. I'd say at best it's a minor improvement, but it wouldn't have many downsides either. |