Bug 2011 – opStar should be called opDeref

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2008-04-18T19:49:00Z
Last change time
2015-06-09T01:14:35Z
Assigned to
nobody
Creator
wbaxter

Comments

Comment #0 by wbaxter — 2008-04-18T19:49:45Z
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.
Comment #1 by clugdbug — 2010-02-12T00:18:45Z
This is obsolete now with the new operator overloading scheme. It's now opUnary!("*"), and will never be opDeref.