posted 19 years ago
An interesting topic !!
It's easy to understand the motivation for eliminating operator overloading for the reasons of preventing the abuses that were seen in C++. However, "operator extension", for true value types really is a nice expressive and transparent concept.
It's hard to make a good argument given a true value type like a Complex number class that
is somehow more transparent than
The real problem is the potential for inappropriate "operator subversion".
Preprocessor is just another name for "code generator". I guess if I wanted this syntax badly enough I could write my own preprocessor. but it's a lot of work and an extra build step.
The other issue of multiple inheritance has similar valid motivations. Unlike opertor overloading however, the attempt to keep multiple inheritance out of the Java software development world has been made largely irrelevant by the growth of the use of AOP to implement cross cutting behavior. AOP strategies have been around in the Java world for quite a while now to implement cross cutting behavior for remoting, security, and transactions. AOP techniques encompass all the Java power tools, reflection (dynamic proxies), code generation, custom class loaders, attribute metadata, and bytecode manipulation. AOP has the potential to make software more transparent and reusable by eliminating the tangle that occurs when mixing cross cutting aspects in with the domain logic.
As any factory or construction worker can tell you, power tools can be very dangerous and should be used with safety and good judgement. Just because they are dangerous doesn't mean we shouldn't use them. A healthy dose of common sense and a professional engineering approach to their use should rule the day so that they make software more transparent and reusable, not less.
[ February 08, 2005: Message edited by: Ken Krebs ]
[ February 08, 2005: Message edited by: Ken Krebs ]
kktec<br />SCJP, SCWCD, SCJD<br />"What we observe is not nature itself, but nature exposed to our method of questioning." - Werner Heisenberg