digitalmars.D - Diagnostics for redundant qualifiers
- Per =?UTF-8?B?Tm9yZGzDtnc=?= (11/11) Jul 28 2021 What about making
- Paul Backus (7/18) Jul 28 2021 What's the harm in allowing redundant attributes?
- Nicholas Wilson (3/14) Jul 28 2021 No, think about if `f` is generated from a string or template
- Walter Bright (8/23) Jul 29 2021 The compiler will complain about:
- Per =?UTF-8?B?Tm9yZGzDtnc=?= (2/4) Jul 30 2021 Seems reasonable. Thanks.
What about making
```d
safe struct S {
void f() safe {}
}
```
warn or deprecate as
```
Warning: redundant function attribute ` safe`
```
?
Jul 28 2021
On Wednesday, 28 July 2021 at 18:54:12 UTC, Per Nordlöw wrote:
What about making
```d
safe struct S {
void f() safe {}
}
```
warn or deprecate as
```
Warning: redundant function attribute ` safe`
```
?
What's the harm in allowing redundant attributes?
Generally, warnings are helpful when they point out code that is
likely to do something different from what the programmer
intended (e.g., `if (a = b)`). If the programmer wrote ` safe` in
two places, I'd say there's very little chance they did it by
mistake.
Jul 28 2021
On Wednesday, 28 July 2021 at 18:54:12 UTC, Per Nordlöw wrote:
What about making
```d
safe struct S {
void f() safe {}
}
```
warn or deprecate as
```
Warning: redundant function attribute ` safe`
```
?
No, think about if `f` is generated from a string or template
mixin.
Jul 28 2021
On 7/28/2021 11:54 AM, Per Nordlöw wrote:
What about making
```d
safe struct S {
void f() safe {}
}
```
warn or deprecate as
```
Warning: redundant function attribute ` safe`
```
?
The compiler will complain about:
safe safe void test();
but not:
safe { safe void test(); }
safe: safe void bar();
This is quite deliberate. It's the same for all the attributes.
Nicholas has the right justification.
Jul 29 2021
On Thursday, 29 July 2021 at 17:22:28 UTC, Walter Bright wrote:This is quite deliberate. It's the same for all the attributes. Nicholas has the right justification.Seems reasonable. Thanks.
Jul 30 2021









Paul Backus <snarwin gmail.com> 