On 04/15/2016 03:44 PM, Steven Schveighoffer wrote:
No, because it's not sound. you cannot cast to const through 2+
indirections. However inout works there.

That is correct, a classic... thanks for getting me straight.

I think the point of Kenji's argument is that inout's current
limitations are what you are bumping into, and those limitations are
unnecessary and arbitrary. We can make inout better and more consistent.
Pretty easily actually. We can certainly fix the inout int = 0 problem.

I'm not sure - at all in fact. This is at the tail of a sequence of
changes of inout, and there is a history of such mini-designs leading to
complications, regressions, and further mini-designs. It's the wolf that
eats the dog that eats the cat that eats the mouse. We fix this and
there's another and then another and then another. It has already
happened.

I assure you, these limitations were self-imposed. I insisted on them,
without realizing that they would cause problems with generic code. I
thought they would be good "lint" detection.

https://issues.dlang.org/show_bug.cgi?id=3748

Problem is we could have other problems once we fix those. As you just showed, it has already happened.

We should really do away with the cowboy style of designing language, which sadly Walter and I have been guilty of too often in the past. The slow but sure accretion of complexity of inout is a textbook example of where that leads.


Andrei

Reply via email to