www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2011] New: opStar should be called opDeref

reply d-bugmail puremagic.com writes:

           Summary: opStar should be called opDeref
           Product: D
           Version: 2.012
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: wbaxter gmail.com

Over a year ago when I suggested that operators in D should be written more
like op(+) because it's too hard to remember all those operator names (opCom
anyone?) Walter told me that opAdd is opAdd because if you're going to overload
"+" it better be for the purpose of implementing addition.  Hence the name is
opAdd, not op(+) or opPlus.

So now why do we have opStar?  Does the fact that it's named after the operator
rather than the operation mean that it's ok to abuse it for whatever purpose
you like, unlike "+","/", etc.?

Additionally the naming is ambiguious since "*" is also used for

Since unary "*" dereferences a variable, the name of the method should be
opDeref. (We don't say opDivide or opMultipy, so the use of abbreviation is

This has been debated on the NG before and I don't recall any opposition to the
suggestion that opStar is the wrong name.
I can't find the relevant newsgroup threads now, but if someone can, please add

Apr 18 2008
parent d-bugmail puremagic.com writes:

Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |INVALID

--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-02-12 00:18:45 PST ---
This is obsolete now with the new operator overloading scheme. It's now
opUnary!("*"), and will never be opDeref.

Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 12 2010