DIP1000: 'return scope' ambiguity and why you can't make opIndex work

Dennis dkorpel at gmail.com
Sat Jun 19 14:37:24 UTC 2021


On Saturday, 19 June 2021 at 13:47:06 UTC, Ola Fosheim Grøstad 
wrote:
> This is a good reason to have an experimental branch and let 
> new features sit there until people get enough experience with 
> them.

DIP1000 is still behind a preview switch, which you could 
consider an experimental branch, and it has been for five years 
now. I don't think incubation time is the problem here, but 
rather the lack of documentation and thorough testing. Now we 
have some code bases (most notably Phobos) that compile with 
-dip1000 but only because of hacks and bugs such as [inout 
implies return](https://issues.dlang.org/show_bug.cgi?id=22027), 
[pure implies 
scope](https://issues.dlang.org/show_bug.cgi?id=20150), [address 
of ref isn't 
scope](https://issues.dlang.org/show_bug.cgi?id=20245), 
[conflation of return-ref and 
return-scope](https://issues.dlang.org/show_bug.cgi?id=21868), 
[getting a slice to a scope static array is 
allowed](https://issues.dlang.org/show_bug.cgi?id=20505), 
[separate compilation isn't 
checked](https://issues.dlang.org/show_bug.cgi?id=20023), ...

Those were great in the short term because they minimize the 
amount of breaking changes when turning on -dip1000. In the long 
term, all this code relying on accepts-invalid bugs is annoying 
to fix though.


More information about the Digitalmars-d mailing list