C++ Logo

std-proposals

Advanced search

Re: [std-proposals] A new C++ keyword: forget

From: Marcin Jaczewski <marcinjaczewski86_at_[hidden]>
Date: Wed, 12 Aug 2026 02:08:40 +0200
śr., 12 sie 2026 o 00:34 Ville Voutilainen via Std-Proposals
<std-proposals_at_[hidden]> napisał(a):
>
> On Wed, 12 Aug 2026 at 01:29, Henry Skoglund <henry_at_[hidden]> wrote:
>
> > Good idea with a std:: prefix, avoids breaking someone's code that has a
> > type called "forget".
>
> Bingo. :)
>
> > What about std::redact()?
>
> I quite like it. After you redact a name, code that follows it
> considers the declaration of the name
> as having been redacted, and can't name or redeclare the thing. The
> name's earlier declaration
> is there for cleanup purposes, but for post-redaction naming purposes,
> it's just sharpied all over.
>

if this is `std::redact` this means its normal function as it can't be
a keyword, right?
This means it will need some tag to mark this behavior like:

```
void redact([[redact]] auto& val) {}
```

And then could be useful to put this on other functions too?
Like:

```
class Foo
{
    int i;
    void dispose() [[redact]]; //as it refer to `this`
}

int main()
{
    Foo a;
    a.i = 1;
    a.dispose();
    //a..i = 2; //error
}
```

Another thing we could simply use:

```
int a = 3;
[[redact]] a;
```


> Maybe even better names exist, but that's a very explicable analogy,
> if you ask me.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2026-08-12 00:08:57