Date: Tue, 11 Aug 2026 22:56:10 +0300
On Tue, 11 Aug 2026 at 22:47, Jens Maurer <jens.maurer_at_[hidden]> wrote:
>
>
>
> On 8/11/26 21:12, Ville Voutilainen via Std-Proposals wrote:
> > 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.
>
> Except this particular example doesn't do name lookup.
> You're matching declarations.
Fine. If name lookup finds the name, or a previous declaration is
reachable, and a 'forget'-declaration is reachable,
then the declaration, or the use, is ill-formed. Happier?
> What about this situation:
>
> int x;
>
> void f()
> {
> forget x;
> ++x; // error
> double x; // error?
> }
It is certainly more forward-compatible to make both of those
ill-formed, than make the second well-formed and regret it later.
..and it's also reasonable to make that forget-declaration declare the
name as forgotten in that scope, and not allow a shadowing declaration
to see through it.
>
>
> Or this:
>
> int x;
> forget x;
>
> void g()
> {
> int x; // ok?
> }
This one we might want to allow.
>
>
>
> On 8/11/26 21:12, Ville Voutilainen via Std-Proposals wrote:
> > 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.
>
> Except this particular example doesn't do name lookup.
> You're matching declarations.
Fine. If name lookup finds the name, or a previous declaration is
reachable, and a 'forget'-declaration is reachable,
then the declaration, or the use, is ill-formed. Happier?
> What about this situation:
>
> int x;
>
> void f()
> {
> forget x;
> ++x; // error
> double x; // error?
> }
It is certainly more forward-compatible to make both of those
ill-formed, than make the second well-formed and regret it later.
..and it's also reasonable to make that forget-declaration declare the
name as forgotten in that scope, and not allow a shadowing declaration
to see through it.
>
>
> Or this:
>
> int x;
> forget x;
>
> void g()
> {
> int x; // ok?
> }
This one we might want to allow.
Received on 2026-08-11 19:56:29
