[Issue 2011] New: opStar should be called opDeref
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Apr 18 17:49:48 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2011
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 at digitalmars.com
ReportedBy: wbaxter at 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
multiplication.
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
consistent).
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
them.
--
More information about the Digitalmars-d-bugs
mailing list