Feedback Thread: DIP 1042--ProtoObject--Community Review Round 1
RazvanN
razvan.nitu1305 at gmail.com
Tue Jan 11 09:33:16 UTC 2022
On Monday, 10 January 2022 at 14:32:54 UTC, Elronnd wrote:
> This is fine; hashing was not an advertised part of their API,
> and no one was using it anyway. No one's code broke as a
> result of this. I would nominally feel very comfortable making
> such a change and would not consider it a compatibility break.
> _Except_ that, when a user tries to combine libraries X and Y,
> their code will break.
>
Are you referring to the case where a method from library Y
returns
an instance of something that inherits ProtoObject (but not
Object)
and then when the instance is passed to some_function in library
X,
some_function might make assumptions that are false about the
instance
(for example, assumes that the instance has a toHash)? Indeed,
this is
a bit nasty, but what could be done to ease the transition:
library Y owner
can put some deprecated toHash function in his classes that
inherit
ProtoObject. Even better, we will provide some utilities [1] that
make it
trivial to implement the methods that Object provides.
Eventually, Object
should be deprecated and that will make everyone upgrade their
code to
ProtoObject.
[1] https://github.com/dlang/phobos/pull/7049
More information about the Digitalmars-d
mailing list