Greenwashing

rikki cattermole rikki at cattermole.co.nz
Thu May 28 15:15:52 UTC 2020


On 29/05/2020 3:00 AM, Steven Schveighoffer wrote:
> But I'm thinking we are approaching this wrong. We should simply make 
> inference the default, and opt out by using an attribute or some other 
> mechanism (pragma?). It would have the same effect but not break all 
> code in existence.

I had the same realization a few days ago.

The fact that you have to type @safe and @system at all is the real problem.

Apart from function pointers and explicit overriding you should not be 
writing them normally.

.di files would be generated with the annotations regardless of if it is 
supplied by user or not.

The trick to get this to work well AND have false positives (i.e. a 
function that is @system but appears @safe and vice versa) is to do the 
inferring as early as possible.

This sounds crazy, but it would force people to consider if it should be 
@trusted or if it was just something that needs fixing. The goal would 
be to make @safe transitively poison the call stack to require fixing. 
But if most D code already is @safe, what is there to worry about?


More information about the Digitalmars-d mailing list