Proposal: __not(keyword)
Neia Neutuladh
neia at ikeran.org
Fri Sep 14 18:44:11 UTC 2018
On Friday, 14 September 2018 at 18:13:49 UTC, Eugene Wissner
wrote:
> Makes the code unreadable. You have to count all attributes in
> the file, then negate them. Nobody should write like this and
> therefore it is good, that there isn't something like __not.
>
> For @nogc, pure and so forth there were imho a better proposal
> with a boolean value:
> @gc(true), @gc(false), pure(true), pure(false) etc. It is also
> consistent with the existing UDA syntax.
The two proposals are extremely similar in effect. Under Adam D
Ruppe's proposal, I could write:
__not(@nogc) void foo() {}
Here, @nogc wasn't set, so I didn't need to specify any
attributes. If @nogc: had been specified a thousand times just
above this function, __not(@nogc) would still make `foo` be
not- at nogc.
Identically, under your proposal, I could write:
@gc(true) void foo() {}
If this is the entire file, the annotation has no effect. If
@gc(false) had been specified a thousand times just above this
function, the annotation would still make `foo` be not- at nogc.
There's no counting of attributes to negate. You just negate
everything that doesn't apply to this function.
More information about the Digitalmars-d
mailing list