On Monday, 28 July 2014 at 00:23:36 UTC, H. S. Teoh via
Digitalmars-d wrote:
On Sun, Jul 27, 2014 at 07:04:08PM +0000, Fool via
Digitalmars-d wrote:
Similarly, the user is free to define opCmp without
restriction. In
practice, however, it does not seem to make any sense if <=
does not
even model a preorder (reflexive and transitive) or one of >,
<=, <
does not match.
The problem with imposing these kinds of restrictions, is that
they are
generally not enforceable (at least, not without significantly
crippling
legitimate use cases). At some point, we have to stop
babysitting the
programmer and trust that he's competent enough to not try to
subvert
the language to make it do stuff it wasn't intended to do.
That's missing the point completely. If the compiler cannot
obtain meta information about the properties of relations then
you cannot introduce high level optimization and generic
programming becomes crippled and a second rate citizen.