www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - operators in language reference

reply "Dominikus Dittes Scherkl" writes:
There is a gapping hole in the language reference: The operators 
are nowhere described.
Ok, most of them are the same as in C and C++, but there are 
subtle differences (e.g. different precedence) and some are new 
(the floating point comparisons have their own chapter and they 
are about to beeing deprecated, but what about >>>, ^^, ^^=, =>, 
., is, in ?).
And even if they where all the same as in C or C++, not everybody 
comes from those languages and D should be understandable without 
such kind of background knowledge, I think.
Apr 01 2015
parent reply "John Colvin" <john.loughran.colvin gmail.com> writes:
On Wednesday, 1 April 2015 at 10:06:20 UTC, Dominikus Dittes 
Scherkl wrote:
 There is a gapping hole in the language reference: The 
 operators are nowhere described.
 Ok, most of them are the same as in C and C++, but there are 
 subtle differences (e.g. different precedence) and some are new 
 (the floating point comparisons have their own chapter and they 
 are about to beeing deprecated, but what about >>>, ^^, ^^=, 
 =>, ., is, in ?).
 And even if they where all the same as in C or C++, not 
 everybody comes from those languages and D should be 
 understandable without such kind of background knowledge, I 
 think.
http://dlang.org/expression.html and related http://dlang.org/operatoroverloading.html
Apr 01 2015
parent reply "Dominikus Dittes Scherkl" writes:
On Wednesday, 1 April 2015 at 10:39:01 UTC, John Colvin wrote:
 On Wednesday, 1 April 2015 at 10:06:20 UTC, Dominikus Dittes 
 Scherkl wrote:
 There is a gapping hole in the language reference: The 
 operators are nowhere described.
 Ok, most of them are the same as in C and C++, but there are 
 subtle differences (e.g. different precedence) and some are 
 new (the floating point comparisons have their own chapter and 
 they are about to beeing deprecated, but what about >>>, ^^, 
 ^^=, =>, ., is, in ?).
 And even if they where all the same as in C or C++, not 
 everybody comes from those languages and D should be 
 understandable without such kind of background knowledge, I 
 think.
http://dlang.org/expression.html
This describes what operators (tokens) exist and what operands they can take (form a grammar point of view), but not what they do. You may say that's obvious, but I know languages where even "+" doesn't do what one might expect.
 and related http://dlang.org/operatoroverloading.html
Yes, this goes further into details what operands an operator take (especially if it is only one or two or more operands), but not what they do - in this chapter this is especially useless, as if I overload an operator, it will do whatever I want it to do even if it is strange as hell. So this is not the right place to describe the default behaviour of an operator (but ok, It should refer to that place --- if only there would be one!).
Apr 01 2015
parent reply "John Colvin" <john.loughran.colvin gmail.com> writes:
On Wednesday, 1 April 2015 at 10:53:57 UTC, Dominikus Dittes 
Scherkl wrote:
 On Wednesday, 1 April 2015 at 10:39:01 UTC, John Colvin wrote:
 On Wednesday, 1 April 2015 at 10:06:20 UTC, Dominikus Dittes 
 Scherkl wrote:
 There is a gapping hole in the language reference: The 
 operators are nowhere described.
 Ok, most of them are the same as in C and C++, but there are 
 subtle differences (e.g. different precedence) and some are 
 new (the floating point comparisons have their own chapter 
 and they are about to beeing deprecated, but what about >>>, 
 ^^, ^^=, =>, ., is, in ?).
 And even if they where all the same as in C or C++, not 
 everybody comes from those languages and D should be 
 understandable without such kind of background knowledge, I 
 think.
http://dlang.org/expression.html
This describes what operators (tokens) exist and what operands they can take (form a grammar point of view), but not what they do. You may say that's obvious, but I know languages where even "+" doesn't do what one might expect.
With exception of the ones that are the same in C, I can't spot any that are missing an explanation. I agree that it would be good to have a more beginner friendly description of them all, but to a C(++) programmer I would say that document contains the info they need.
Apr 01 2015
parent reply "Dominikus Dittes Scherkl" writes:
On Wednesday, 1 April 2015 at 11:18:26 UTC, John Colvin wrote:
 On Wednesday, 1 April 2015 at 10:53:57 UTC, Dominikus Dittes 
 Scherkl wrote:
 On Wednesday, 1 April 2015 at 10:39:01 UTC, John Colvin wrote:
 On Wednesday, 1 April 2015 at 10:06:20 UTC, Dominikus Dittes 
 Scherkl wrote:
 There is a gapping hole in the language reference: The 
 operators are nowhere described.
 Ok, most of them are the same as in C and C++, but there are 
 subtle differences (e.g. different precedence) and some are 
 new (the floating point comparisons have their own chapter 
 and they are about to beeing deprecated, but what about >>>, 
 ^^, ^^=, =>, ., is, in ?).
 And even if they where all the same as in C or C++, not 
 everybody comes from those languages and D should be 
 understandable without such kind of background knowledge, I 
 think.
http://dlang.org/expression.html
This describes what operators (tokens) exist and what operands they can take (form a grammar point of view), but not what they do. You may say that's obvious, but I know languages where even "+" doesn't do what one might expect.
With exception of the ones that are the same in C, I can't spot any that are missing an explanation. I agree that it would be good to have a more beginner friendly description of them all, but to a C(++) programmer I would say that document contains the info they need.
Yeah, but scattered all over the different chapters. And not describing those that are the same in C++ is like not describing the types float and short, just because they are the same in C++. I find it lacking if I have to tell a newbie "look in the documentation for some other language for the definition of the operators that you can't find here somewhere"
Apr 01 2015
next sibling parent "John Colvin" <john.loughran.colvin gmail.com> writes:
On Wednesday, 1 April 2015 at 12:40:26 UTC, Dominikus Dittes 
Scherkl wrote:
 On Wednesday, 1 April 2015 at 11:18:26 UTC, John Colvin wrote:
 On Wednesday, 1 April 2015 at 10:53:57 UTC, Dominikus Dittes 
 Scherkl wrote:
 On Wednesday, 1 April 2015 at 10:39:01 UTC, John Colvin wrote:
 On Wednesday, 1 April 2015 at 10:06:20 UTC, Dominikus Dittes 
 Scherkl wrote:
 There is a gapping hole in the language reference: The 
 operators are nowhere described.
 Ok, most of them are the same as in C and C++, but there 
 are subtle differences (e.g. different precedence) and some 
 are new (the floating point comparisons have their own 
 chapter and they are about to beeing deprecated, but what 
 about >>>, ^^, ^^=, =>, ., is, in ?).
 And even if they where all the same as in C or C++, not 
 everybody comes from those languages and D should be 
 understandable without such kind of background knowledge, I 
 think.
http://dlang.org/expression.html
This describes what operators (tokens) exist and what operands they can take (form a grammar point of view), but not what they do. You may say that's obvious, but I know languages where even "+" doesn't do what one might expect.
With exception of the ones that are the same in C, I can't spot any that are missing an explanation. I agree that it would be good to have a more beginner friendly description of them all, but to a C(++) programmer I would say that document contains the info they need.
Yeah, but scattered all over the different chapters.
I meant just in http://dlang.org/expression.html. All the novel operators are described there, including what they do.
 And not describing those that are the same in C++ is like not 
 describing the types float and short, just because they are the 
 same in C++. I find it lacking if I have to tell a newbie "look 
 in the documentation for some other language for the definition 
 of the operators that you can't find here somewhere"
Agreed.
Apr 01 2015
prev sibling parent reply ketmar <ketmar ketmar.no-ip.org> writes:
On Wed, 01 Apr 2015 12:40:24 +0000, Dominikus Dittes Scherkl wrote:

 I find it lacking if I have to tell a newbie "look in the documentation
 for some other language for the definition of the operators that you
 can't find here somewhere"
newbie should read some textbook first.=
Apr 01 2015
parent reply "John Colvin" <john.loughran.colvin gmail.com> writes:
On Wednesday, 1 April 2015 at 13:36:38 UTC, ketmar wrote:
 On Wed, 01 Apr 2015 12:40:24 +0000, Dominikus Dittes Scherkl 
 wrote:

 I find it lacking if I have to tell a newbie "look in the 
 documentation
 for some other language for the definition of the operators 
 that you
 can't find here somewhere"
newbie should read some textbook first.
I think the language reference should be a comprehensive document that doesn't technically require someone to know C(++) first to understand. It doesn't necessarily have to be newbie friendly, but it should be complete.
Apr 01 2015
parent reply ketmar <ketmar ketmar.no-ip.org> writes:
On Wed, 01 Apr 2015 15:25:28 +0000, John Colvin wrote:

 On Wednesday, 1 April 2015 at 13:36:38 UTC, ketmar wrote:
 On Wed, 01 Apr 2015 12:40:24 +0000, Dominikus Dittes Scherkl wrote:

 I find it lacking if I have to tell a newbie "look in the
 documentation for some other language for the definition of the
 operators that you can't find here somewhere"
newbie should read some textbook first.
=20 I think the language reference should be a comprehensive document that doesn't technically require someone to know C(++) first to understand. It doesn't necessarily have to be newbie friendly, but it should be complete.
does this including IEEE floating point number description down to bits,=20 for example? as it's essentialy the same thing: requirement to read=20 external sources. i.e. it's good and all that, but where we should draw the line?=
Apr 01 2015
parent reply "Dominikus Dittes Scherkl" writes:
On Wednesday, 1 April 2015 at 15:42:31 UTC, ketmar wrote:
 does this including IEEE floating point number description down 
 to bits,
 for example? as it's essentialy the same thing: requirement to 
 read
 external sources.

 i.e. it's good and all that, but where we should draw the line?
At least a reference to another (concurrent!) language is not so good. D aims to replace C/C++, so it should not refer to its definitions. But ok, I've read the expressions chapter again, and most operators are described good enought. For some it is clear from the naming of the operands (AddExpression implies an arithmetic operation of addition/subtraction) but it is not realy explicitly expressed.
Apr 01 2015
next sibling parent "John Colvin" <john.loughran.colvin gmail.com> writes:
On Wednesday, 1 April 2015 at 15:50:20 UTC, Dominikus Dittes 
Scherkl wrote:
 On Wednesday, 1 April 2015 at 15:42:31 UTC, ketmar wrote:
 does this including IEEE floating point number description 
 down to bits,
 for example? as it's essentialy the same thing: requirement to 
 read
 external sources.

 i.e. it's good and all that, but where we should draw the line?
At least a reference to another (concurrent!) language is not so good. D aims to replace C/C++, so it should not refer to its definitions. But ok, I've read the expressions chapter again, and most operators are described good enought. For some it is clear from the naming of the operands (AddExpression implies an arithmetic operation of addition/subtraction) but it is not realy explicitly expressed.
A table in the wiki with a one-line description and example each would be a nice idea, for a start.
Apr 01 2015
prev sibling parent ketmar <ketmar ketmar.no-ip.org> writes:
On Wed, 01 Apr 2015 15:50:19 +0000, Dominikus Dittes Scherkl wrote:

 At least a reference to another (concurrent!) language is not so good.
why, C/C++ aren't a rivals. it's like telling that mongolfier (C/C++) is=20 a rival to jet airplane (D).=
Apr 01 2015