Object.toString, toHash, opCmp, opEquals

Jonathan M Davis newsgroup.d at jmdavisprog.com
Thu May 9 23:11:33 UTC 2024


On Thursday, May 9, 2024 2:15:27 PM MDT H. S. Teoh via Digitalmars-d wrote:
> On Thu, May 09, 2024 at 01:12:35PM -0600, Jonathan M Davis via Digitalmars-d 
wrote:
> > On Thursday, May 9, 2024 9:24:12 AM MDT H. S. Teoh via Digitalmars-d 
wrote:
> > > On Thu, May 09, 2024 at 01:53:55AM -0600, Jonathan M Davis via
> > > Digitalmars-d>
> > wrote:
> > > > On Wednesday, May 8, 2024 7:20:20 PM MDT Atila Neves via Digitalmars-d
> >
> > wrote:
> > > [...]
> > >
> > > > > I talked to Walter and we agreed that the best way forward is
> > > > > probably to deprecate these member functions and remove them in
> > > > > the next edition.
> > > >
> > > > Yay!
> > >
> > > [...]
> > >
> > > Finally!!  Should've done this years ago.
> >
> > Yeah, but issues with regards to code breakage have made it difficult
> > to do cleanly. Editions should make it much more reasonable.
>
> [...]
>
> Have editions been implementing in any shape/form yet?  Been curious
> about what it looks like, and how it works in practice.

If I understand correctly, some changes have been made in dmd which are
supposed to only be in effect with a new edition, but I don't think that the
actual edition mechanism has been implemented yet. There's been a fair bit
of going back and forth over the details of the proposal (at the moment,
mostly how that would interact with dub), which could affect the
implementation anyway.

At its most basic though, the core idea is that a module could be marked as
being for a specific edition, and it would then be compiled with the rules
for that edition regardless of which edition the code importing it uses (and
that includes any templated code within the module). So, in theory, the code
within that module would continue to work as it always has as new editions
are released, meaning that breaking changes in future editions wouldn't
affect it until that code was updated to be marked as being for a new
edition, at which point, the maintainer would need to update it in whatever
fashion was necessary to get it working properly with the new edition.

So, the reason that we could then make breaking changes with new editions
would be because you can control which edition your code targets, making it
so that those breaking changes don't affect you until you're ready to deal
with them.

Unfortunately, because the program can only use one version of druntime,
which would then need to be able to work with all editions, there are some
things which we likely won't ever be able to change (like it sounds like
we're probably going to be stuck with the monitor in Object), but we'll
definitely be able to make more breaking changes than we can right now.

- Jonathan M Davis





More information about the Digitalmars-d mailing list