Why are opEquals/opCmp arguments not in or const for Objects?
Jonathan M Davis
jmdavisProg at gmx.com
Thu Mar 21 00:51:58 PDT 2013
On Thursday, March 21, 2013 08:29:28 deadalnix wrote:
> Wouldn't that trigger bunch of false warning on legitimate
> overloaded opSomething ?
I'm not sure that overriding a deprecated function triggers a deprecation
warning, but regardless, for opEquals and opCmp, that wouldn't be a problem,
because all classes would be being changed so that their opEquals and opCmp
don't take Object, so the deprecation warnings would be a _good_ thing. It
would probably be more of a problem for toString and toHash though, since they
don't take arguments. Deprecating them won't work if overriding them triggers
deprecation warnings, and the fact that you'll be forced to override them as
long as they're in Object and then won't be allowed to once they're out of
Object will probably mean simply removing them from one release to another and
forcing everyone to immediately change their toHash and toString methods so
that they don't break.
So no, the situation isn't entirely clear-cut, and we'll have to look at it
carefully to avoid as much immediate breakage as possible, but we may be
forced to change some stuff in a way that causes immediate breakage. All that
would depend on what the exact changes are that have to be made and the exact
situation with override and deprecated and all that. And I don't think that
anyone has thought that through completely yet.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list