On 4/10/13 1:33 PM, Manu wrote:
It may as well be a mistake that nonvirtual functions are at all
part of a class' methods. This has been quite painfully seen in C++
leading to surprising conclusions: http://goo.gl/dqZrr.
Hmm, some interesting points. Although I don't think I buy what he's
selling.
That article ain't sellin'. It's destroyin'. It destroys dogma that had
been uncritically acquired by many. That puts it in a nice category
alongside with e.g. http://goo.gl/2kBy0 - boy did that destroy.
It looks like over-complexity for the sake of it to me. I don't buy the
real-world benefit. At least not more so than the obscurity it
introduces (breaking the location of function definitions apart), and of
course, C++ doesn't actually support this syntactically, it needs UFCS.
Granted, the principle applies far better to D, ie, actually works...
If I designed D's classes today, I'd only allow overridable methods
and leave everything else to free functions.
Why?
With UFCS the only possible utility of member functions is clarifying
the receiver in a virtual dispatch. Even that's not strictly necessary
(as some languages confirm).
Andrei