On Monday, 27 March 2017 at 16:28:13 UTC, Gary Willoughby wrote:

Even Andrei was baffled:

http://forum.dlang.org/thread/[email protected]

I see... And Walter went further and reported it as a DMD bug (still open clearly).

It's what I mean. This strange behavior is more typical of C++, in D this is a rare corner case, but I can sympathize if Andrei and Walter don't want to accumulate issues like this one in the language, and on top of that fill the standard library and user code with this kind of workarounds.

First the solution is a hack, but ideally it wouldn't be needed, the original code should have worked with inout ranges all the same. So ideally DMD should be fixed to make the hack unnecessary. Andrei's proposal of deprecating inout entirely is also consistent at the expense of losing a feature.

When I first read about inout as a device to obviate code duplication typical in C++ const ref overloads, I liked it but I assumed it was implemented by lowering it into the actual duplicate overloads. Though I'm not even sure right now if such overloading is allowed in D.

I haven't tried if this happens with other compilers than DMD...

Reply via email to