Date: Thu, 13 Aug 2026 23:15:51 +0100
On 12/08/2026 01:14, Ville Voutilainen via Std-Proposals wrote:
> On Wed, 12 Aug 2026 at 03:08, Marcin Jaczewski
> <marcinjaczewski86_at_[hidden]> wrote:
>> if this is `std::redact` this means its normal function as it can't be
>> a keyword, right?
>
> It's not a normal function. It's a language construct recognized by
> the compiler. And despite
> being spelled like a function, it can be a declaration, like static_assert is.
>
>> This means it will need some tag to mark this behavior like:
>> void redact([[redact]] auto& val) {}
>
> No.
>
>> 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
>> }
>
> Well.. the idea here is to redact names. Not objects. Now you're
> entering a territory
> where we need some sort of flow analysis.
This would be useful, like compile_assert allows
I did Ownership, Optional, Forget at compile-time
https://github.com/jonnygrant/compile_assert/tree/main/experiments/forget
Regards
Jonathan
>
>> Another thing we could simply use:
>> int a = 3;
>> [[redact]] a;
>
> If our construct is a declaration, you can just do
>
> int a = 3;
> std::redact(a);
>
> regardless of what the scope of a is.
> On Wed, 12 Aug 2026 at 03:08, Marcin Jaczewski
> <marcinjaczewski86_at_[hidden]> wrote:
>> if this is `std::redact` this means its normal function as it can't be
>> a keyword, right?
>
> It's not a normal function. It's a language construct recognized by
> the compiler. And despite
> being spelled like a function, it can be a declaration, like static_assert is.
>
>> This means it will need some tag to mark this behavior like:
>> void redact([[redact]] auto& val) {}
>
> No.
>
>> 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
>> }
>
> Well.. the idea here is to redact names. Not objects. Now you're
> entering a territory
> where we need some sort of flow analysis.
This would be useful, like compile_assert allows
I did Ownership, Optional, Forget at compile-time
https://github.com/jonnygrant/compile_assert/tree/main/experiments/forget
Regards
Jonathan
>
>> Another thing we could simply use:
>> int a = 3;
>> [[redact]] a;
>
> If our construct is a declaration, you can just do
>
> int a = 3;
> std::redact(a);
>
> regardless of what the scope of a is.
Received on 2026-08-13 22:15:59
