www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22580] New: [Arrays]

https://issues.dlang.org/show_bug.cgi?id=22580

          Issue ID: 22580
           Summary: [Arrays]
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/
                OS: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: dlang.org
          Assignee: nobody puremagic.com
          Reporter: kurt.krueckeberg comcast.net

I am new to D, but the code example explanation in section 12.6 is confusing.
The code example in section 12.6 refers to the "slice operator":

"When the slice operator appears as the left-hand side of an assignment
expression, it means that the contents of the array are the target of the
assignment rather than a reference to the array..."

Is there really a special "slice operator"? The operator used in the example in
section 12.6 is array index operator, [].  So shouldn't the explanation be
changed to refer to the index operator (being applied to a slice that appears
on the left-hand side of an assignment statement)? To me, it is clearer to say
something like:

"When the slice appears on the left-hand side of an assignment with the index
operator, it means that the contents of the array are the target of the
assignment rather than a reference to the array..."

Or to say:

"When the slice is indexed with the [] operator and it appears on the left-hand
side of an assignment, it means that the contents of the array are the target
of the assignment rather than a reference to the array..."

Or simply:

"When the slice is indexed and it appears on the left-hand side of an
assignment, it means that the contents of the array are the target of the
assignment rather than a reference to the array..."

--
Dec 09 2021