Discussion Thread: DIP 1028--Make @safe the Default--Final Review

Jonathan Marler johnnymarler at gmail.com
Thu Mar 26 04:35:23 UTC 2020


On Thursday, 26 March 2020 at 02:58:26 UTC, Walter Bright wrote:
> On 3/25/2020 10:53 AM, Jonathan Marler wrote:
>> I'm on the fence as to whether this is a good idea.  However, 
>> with all the D code I've written that would break from this 
>> I'd prefer not to do this;
> Are you sure there'd be that much that breaks? If much does 
> break, I'd suggest re-evaluating the coding techniques you use.

I'm constantly re-evaluating and improving my coding techniques.  
Something I love doing actually.  I'm not sure how this feature 
breaking code is related to poor coding techniques though?  The 
point is that to fix code after this feature comes in, I'll need 
to go through thousands of source files and tag code 
appropriately.  What does this have to do with the quality of the 
code itself?

> How about the bugs in your code that it may find? I'm looking 
> forward to applying this to the D code I've written.

If it finds bugs then that's definitely an improvement that could 
justify the breakage.  I don't know about you but the code I 
write almost never has bugs.  It can have errors, and it can be 
unfinished, but almost never bugs. That's from the way I code 
though.  I use a combination of many techniques that make it very 
difficult for bugs to get through. If it does find bugs I would 
be surprised, but I'd love it if it did!

>
> For example, I'm pretty happy with the printf validator added 
> to DMD. I had to fix a lot of my own code, and was glad to get 
> it fixed. I'm happy about every bug that gets fixed the easy 
> way (at compile time).

Yeah this sounds like a good thing to do for printf.

>
> @safe by default is going to improve your code. As 
> professionals, we should be eager for that.

If that's true then I welcome it, but I've got to see it to 
believe it.  I'd be willing to go through some projects and try 
this feature out to see if that's the case.  I assume there's a 
command-line switch to enable it so I could see for myself?



More information about the Digitalmars-d mailing list