Date: Tue, 11 Aug 2026 19:28:02 +0000
Hum, this could be useful if combined with other features.
Something that I want is to be able to make const a variable that is originally not declared const.
Maybe we could have a "shadowing" specifier, that could do that.
Like
shadow(const) var; //makes var const for the remainder of the scope.
shadow(void) var; //makes var inaccessible
I can also see the feature being used as.
class A{};
class B: public A{};
B var;
shadow(const A&) var; //var is still an object of type B but only accessible as an object of parent type A.
I'm not so sure about this last one.
________________________________
From: Std-Proposals <std-proposals-bounces_at_[hidden]> on behalf of Ville Voutilainen via Std-Proposals <std-proposals_at_[hidden]>
Sent: Tuesday, August 11, 2026 9:13:23 PM
To: std-proposals_at_[hidden] <std-proposals_at_[hidden]>
Cc: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Subject: Re: [std-proposals] A new C++ keyword: forget
On Tue, 11 Aug 2026 at 22:11, Henry Skoglund via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> On 2026-08-11 21:05, Simon Schröder wrote:
> > This reminds me (in case you are continuing with the proposal): You should discuss if once a variable has been poisoned, if the same name can be reused for a different variable.
> Hi, once poisoned I think it should not be allowed to be reused. I.e.
> issue a compiler error like:
> double raw;
> forget raw;
> int raw; // <--- error: raw is forgotten and cannot be resurrected
Exactly. Make name lookup still find the name, but make it an error to
find a poisoned name.
Something that I want is to be able to make const a variable that is originally not declared const.
Maybe we could have a "shadowing" specifier, that could do that.
Like
shadow(const) var; //makes var const for the remainder of the scope.
shadow(void) var; //makes var inaccessible
I can also see the feature being used as.
class A{};
class B: public A{};
B var;
shadow(const A&) var; //var is still an object of type B but only accessible as an object of parent type A.
I'm not so sure about this last one.
________________________________
From: Std-Proposals <std-proposals-bounces_at_[hidden]> on behalf of Ville Voutilainen via Std-Proposals <std-proposals_at_[hidden]>
Sent: Tuesday, August 11, 2026 9:13:23 PM
To: std-proposals_at_[hidden] <std-proposals_at_[hidden]>
Cc: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Subject: Re: [std-proposals] A new C++ keyword: forget
On Tue, 11 Aug 2026 at 22:11, Henry Skoglund via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> On 2026-08-11 21:05, Simon Schröder wrote:
> > This reminds me (in case you are continuing with the proposal): You should discuss if once a variable has been poisoned, if the same name can be reused for a different variable.
> Hi, once poisoned I think it should not be allowed to be reused. I.e.
> issue a compiler error like:
> double raw;
> forget raw;
> int raw; // <--- error: raw is forgotten and cannot be resurrected
Exactly. Make name lookup still find the name, but make it an error to
find a poisoned name.
-- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2026-08-11 19:28:10
