DIP 1029---Add throw as Function Attribute---Community Review Round 1

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Wed Jan 15 10:36:01 UTC 2020


On Wednesday, 15 January 2020 at 07:33:14 UTC, Walter Bright 
wrote:
> Best practice:
>
>     struct S
>     {
>         throw @safe pure @nogc etc. etc. etc. etc. ...
>         ...
>     }
>
> and then have to remember to add to that list for every new 
> attribute. It's ugly, and people are going to hate it.

Honestly, based on experience of maintaining larger D codebases, 
I'm not sure it isn't anyway best practice to apply attributes 
(including protection attributes) only ever to individual symbols 
and functions.

It can look a bit verbose, and obviously it can be annoying in 
the way you describe, but it really helps avoid any doubt what 
attributes apply in any given case.


More information about the Digitalmars-d mailing list