On Tuesday, June 07, 2016 18:33:01 Dave via Digitalmars-d wrote: > On Tuesday, 7 June 2016 at 18:24:33 UTC, Walter Bright wrote: > > On 6/7/2016 11:19 AM, Jack Stouffer wrote: > >> On Tuesday, 7 June 2016 at 18:15:28 UTC, Walter Bright wrote: > >>> [...] > >> > >> But you can't grep for @system because 99% of the time it's > >> implicit. This > >> problem becomes harder to find when using templates for > >> everything, which I do. > > > > Add: > > @safe: > > at the top of your D module and you'll find the @system code. > > The D compiler is the static analysis tool. It's true that > > @safe should have been the default, but too much code would > > break if that were changed. Adding one line to the top of a > > module is very doable for those that are desirous of adding the > > safety checks. > > > > You can also add: > > @nogc: > > at the top, too. It isn't necessary to tediously annotate every > > function. > > Seems fair. But perhaps phobos should also follow this standard? > Which might be why people get the mindset that they have to > annotate everything...
IMHO, it's bad practice to mass apply attributes with labels or blocks. It's far too easy to accidentally mark a function with an attribute that you didn't mean to, and it makes it way harder to figure out which attributes actually apply to a function. And when you add templates into the mix, applying attributes en masse doesn't work anyway, because pretty much the only time that you want to mark a template function with an attribute is when the template arguments have nothing to do with whether the attribute is appropriate or not. So, while mass applying something like @safe temporarily to check stuff makes some sense, I really don't think that it's a good idea to do it in any code that you'd ever commit. - Jonathan M Davis