Date: Wed, 12 Aug 2026 01:18:59 +0300
On Wed, 12 Aug 2026 at 01:14, Henry Skoglund via Std-Proposals
<std-proposals_at_[hidden]> wrote:
> >>>> 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.
> >> Then "forget" is not the right word, since the name is clearly not
> >> forgotten.
> > Sure, agreed.
>
> Yeah the compiler needs to remember it, since the destructor still have
> to run in the same place (end of scope, as if there was no forget
> statement).
That's not a thing that affects whether the name can be used after new
declarations after poisoning an old name.
The compiler doesn't need an object's name to make sure it's correctly
cleaned up.
> So "forget" is indeed a bit of a misnomer, I was toying with other verbs
> like "begone", "perish", "ban". But "forget" kind of nails it anyway :-)
you could name it std::poison_name(). Or perhaps to avoid untoward
connotations, std::disable_name().
And no, that doesn't require including a header.
<std-proposals_at_[hidden]> wrote:
> >>>> 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.
> >> Then "forget" is not the right word, since the name is clearly not
> >> forgotten.
> > Sure, agreed.
>
> Yeah the compiler needs to remember it, since the destructor still have
> to run in the same place (end of scope, as if there was no forget
> statement).
That's not a thing that affects whether the name can be used after new
declarations after poisoning an old name.
The compiler doesn't need an object's name to make sure it's correctly
cleaned up.
> So "forget" is indeed a bit of a misnomer, I was toying with other verbs
> like "begone", "perish", "ban". But "forget" kind of nails it anyway :-)
you could name it std::poison_name(). Or perhaps to avoid untoward
connotations, std::disable_name().
And no, that doesn't require including a header.
Received on 2026-08-11 22:19:18
