What about making
@safe struct S {
void f() @safe {}
}
warn or deprecate as
Warning: redundant function attribute `@safe`
?
Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
July 28, 2021 Diagnostics for redundant qualifiers | ||||
---|---|---|---|---|
| ||||
What about making
warn or deprecate as
? |
July 28, 2021 Re: Diagnostics for redundant qualifiers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Wednesday, 28 July 2021 at 18:54:12 UTC, Per Nordlöw wrote: >What about making
warn or deprecate as
? 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., |
July 28, 2021 Re: Diagnostics for redundant qualifiers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Wednesday, 28 July 2021 at 18:54:12 UTC, Per Nordlöw wrote: >What about making
warn or deprecate as
? No, think about if |
July 29, 2021 Re: Diagnostics for redundant qualifiers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | 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.
|
July 30, 2021 Re: Diagnostics for redundant qualifiers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | 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. |