Dlist and dip1000 challenge

Steven Schveighoffer schveiguy at gmail.com
Thu Oct 25 13:50:15 UTC 2018


On 10/23/18 6:10 PM, Walter Bright wrote:
> On 10/23/2018 8:10 AM, Steven Schveighoffer wrote:
>> So, here is one other thing I want to say. This took me HOURS to find, 
>> and narrow down. Not because I don't understand the concepts behind 
>> dip1000, but because the compiler has fully inserted so many hidden 
>> scopes, I don't know what the actual code it's compiling is. One big 
>> problem I think with dip1000 is simply that it's nearly impossible to 
>> understand where the issues are. Like I said at the end of the post 
>> above, the result of allowing compiler inference of dip1000 is that 
>> your whole program is simply marked unsafe, and you have absolutely no 
>> idea where it is. You can't even guess, because scope just shows up 
>> where you never typed it. Given that you NEED this functionality on 
>> templates, it's going to result, IMO, in people either not using 
>> dip1000, or giving up and adding @trusted: to the top of their file. 
>> This is going to be horrible if we can't find a way to either require 
>> scope instead of inferring it in some cases, or create a way to 
>> diagnose where the blasted problem actually is. Maybe something to say 
>> "I expected this call to be @safe, why isn't it".
> 
> My improvements to DIP1000 are completely dead in the water due to lack 
> of interest. It's impossible to make Phobos DIP1000 compatible if nobody 
> is willing to approve the improvements.
> 
> https://github.com/dlang/dmd/pull/8504

I know this debate is continuing. But that PR has nothing to do with the 
problem I'm having (what this post is really about). I'm not returning 
anything via the first parameter. Just for kicks, I downloaded your PR 
branch, and it still has the same problem with somehow assuming 
something is scope. So can you address this problem at all?

Alarmingly, the current dlist builds fine with dip1000, even though it 
conceptually is the same thing -- it's just that the casts destroy any 
tracking of lifetimes (or so my theory goes), so it builds happily. We 
don't want people to resort to opacity and casts to get around dip1000.

-Steve


More information about the Digitalmars-d mailing list