C++ Logo

std-proposals

Advanced search

Re: New attribute for experimental features

From: Magnus Fromreide <magfr_at_[hidden]>
Date: Sat, 13 Mar 2021 06:43:36 +0100
On Fri, Mar 12, 2021 at 08:43:21PM +0000, codusnocturnus via Std-Proposals wrote:
> >> If you allow customizing the level to "error", your proposal will need to explain how that level is different from `=delete`.
> >
> > My thinking for that would be, if it were an "advisory" level to the implementation, it could be used to select the default behaviour (so error would make it so that -Werror=... is on by default, and users could suppress with -Wno-error=... or -Wno-...). However, if that's the case, this is probably more granular control in default behaviour then implementations offer already (and would be reasonable to offer).
> > Also, under that interpretation, I'm at a loss to explain "info".
>
> Consider a mostly closed and stable code base with a core library consumed by a number of product applications which are expected to mostly keep pace with library releases. As API breaks are identified for the major version release, they can be marked with an info level diagnostic, which wouldn't be promoted by -Werror and break builds, but would give the application teams notice to start anticipating the change in terms of usage and build machinery. At some point before the major version release (let's say feature freeze), those 'info's change to 'warn', and the application teams are nudged a bit harder to prepare for the major version bump. This process could be used in reverse for "experimental" features.
>
> As Arthur pointed out, the use case for an error level diagnostic is, perhaps, narrower, since =delete is an option. Simply marking a function as deleted, however, doesn't provide an opportunity for a custom message. Extend the above scenario with an emergency patch in which some function must not be used, for whatever reason. A custom diagnostic message could be infinitely more helpful than "error: use of deleted function" in such a scenario.
>

I have asked myself why =deleted is processed before [[deprecated("message")]].
If deprecated is processed first then one gains the ability to provide a
message for deleted functions if one is so inclined.

/MF

Received on 2021-03-12 23:43:43