C++ Logo


Advanced search

Re: [std-proposals] Class Instance Re-Use/Re-Init

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Sun, 14 Aug 2022 20:51:31 -0400
On Sun, Aug 14, 2022 at 8:28 PM Greg McPherran via Std-Proposals
<std-proposals_at_[hidden]> wrote:
> Hi Sebastian,
> >> What do you mean by "once-and-done"?
> Once a ctor is used, the ctor function is no longer available to be called for the existing instance. The re-init concept would be the same idea: Perhaps a syntax such as some_object_instance::(args) where args and overloads are the same as the ctor args and overloads.
> >> .. take the task of writing it over from you.
> Yes, this is my thought. I am requesting things in the language that I would find useful but I'll leave it to the language designers to see the value and determine the syntax. I simply wanted to place it on the table because I think they may be exciting. I will summarize again here:
> Ctor-like re-init special functions that are not available as normal functions after init just as ctor is not available as a normal function on an object.
> const after first init - useful for init'ing global objects that are intended to be constant but one would like the cnage to init them once and only once at runtime (startup).
> class pool keyword or similar idea that causes the compiler to use an object pool for instances of the class.
> So these are all concepts and again I leave them for what they are worth. To me they have worth. If any of the language designers designers see value and would like to correspond, that is fine, but my goal here is to simply leave them on the table for the experts to decide if/how these concepts might be incorporated into the language.

Yeah, that's not really how this mailing list works.

You don't just sort of fling ideas at the committee and tell them to
sort out the details. Proposals happen because someone wants them to
happen *and* puts in the legwork to *make* them happen. An idea goes
nowhere by itself. It needs to be something that (eventually) gets
fleshed out into a proper proposal, presented to the committee,
incorporates feedback, and so forth until it's finally approved.

We can help with fleshing out ideas into proposals, but the main body
of the work has to be done by the person putting forth the proposal.

Received on 2022-08-15 00:51:55