On 7/11/12 12:59 AM, H. S. Teoh wrote:
On Wed, Jul 11, 2012 at 04:59:28AM +0200, Jakob Ovrum wrote:
On Wednesday, 11 July 2012 at 02:02:52 UTC, Andrei Alexandrescu
wrote:
On 7/10/12 9:45 PM, Timon Gehr wrote:
I do not desire logical const as a language feature. But
conservative type systems are not good for everything. The root of
the class hierarchy needs to be good for everything. Object is not
an adequate root any more.
How about we consider just stiffening that upper lip and implement
comparison and hashing without modifying their target?
Andrei
It's more likely to go down like this: programmer attempts to write
his opEquals (or toString etc) within the restrictions of const, but
fails due to the requirements of the implementation (which can
easily go beyond simple performance measures like caching, as
demonstrated). The programmer then writes his own mutable member
function and neglects opEquals altogether. If the programmer is real
nice, he/she will write a throwing opEquals stub.
This is exactly what I was saying. All that beautiful, pristine, perfect
infrastructure we're building in druntime eventually just gets
sidestepped, because it is unable to cater for what the programmer
needs, and so the programmer ends up reimplementing his own
infrastructure, over and over again. I can't see how that is beneficial.
How often do you need memoization? It's not even recognized by this
mailer's editor.
Andrei