www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18998] New: Improve Operator Overloading docs


          Issue ID: 18998
           Summary: Improve Operator Overloading docs
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dlang.org
          Assignee: nobody puremagic.com
          Reporter: turkeyman gmail.com

The language Operator Overloading document has devolved into chaos!

Picture that you don't know D, and you want to learn about operator
overloading, and now read that document.

Press Ctrl-F and type "opSlice", scroll the highlighted text, try and
understand how to implement a slicing operator properly. Note that the first
contact you see looks like this:
  `-a[i..j]    a.opIndexUnary!("-")(a.opSlice(i, j))`  wat?!

I think this document needs a complete overhaul, starting with a list of
special operators that exist, description of each special operator and example
of how they work in **the most simple case**, and show complex compounds and
aggregate rewrites towards the end, only after the basic meaning of all
operators has been established.

This is a critical language document, and it's not terribly helpful to new

Jun 16 2018