On Monday, March 05, 2018 17:35:28 ShadoLight via Digitalmars-d-announce 
wrote:
> Very interesting and well written! Jonathan, your experiences
> with const in C++/Java just about matches my experiences with it.
> I also feel that the situation in D is less than ideal in this
> regard.
>
> First, a small (for sure copy-pasta) typo in your article:
>
> const(int[]) arr1 = getArray();
> const(int)[] arr2 = p1;  //Sure you meant arr2 = arr1;

Thanks. Fixed.

> Regarding the proposed solution to the issues with Object namely
> "the solution to this problem which was agreed to a few years ago
> was to remove opEquals, opCmp, toHash, and toString from Object
> so that derived classes can define them with whatever attributes
> are desired" which, you say, will never happen because of too
> much code breakage...
>
> What about the following? Currently the compiler is smart enough,
> so you can define class Foo and explicitly inherit from Object if
> you prefer:
...
> Why was something like this not considered (you don't give a
> link, so I cannot investigate), rather than simply removing them
> from Object? Can this be exploited to, in effect, create the same
> opportunity but minus the breakage? Or am I missing something?

As I mentioned, there was recently some talk about creating a DIP to add a
new root object below Object. If that's done, presumably, Object will still
be the default to avoid code breakage, but it would be provide essentially
what you're talking about. However, such a DIP still has to be written, so
anything at this point is speculation as to what it's going to look like. At
the time that it was decided to remove the functions from Object, it was
more reasonable than it would be now (since D is definitely older now with a
larger user base), and the details of how it would be done were never fully
decided, which is part of why it's never come to fruition in spite of it
being clear that we needed a root object without those functions.

- Jonathan M Davis

Reply via email to