On Monday, 28 October 2019 at 20:23:50 UTC, Walter Bright wrote:
On 10/28/2019 12:23 PM, jmh530 wrote:
Is there a connection between this DIP and the restrict
qualifier in C? This DIP basically ensures that in @safe code,
if a piece of data is accessed only through scope pointers,
then there must be only one mutable pointer to said data or
they are all const. That there is only one mutable way to
access data sounds like restrict to me. I would think that
would enable some optimizations in @safe code.
I hadn't thought of that, it is an interesting observation.
Just for context, here's a paper arguing restrict without tooling
is a bad idea:
http://people.cs.pitt.edu/~mock/papers/clei2004.pdf . Having the
compiler enforce it changes the game substantially, I think.