- Preserving ref qualifiers in operator-> overload - 4 Updates
Manfred <noname@add.invalid>: Jun 07 05:54PM +0200 On 5/28/2020 4:21 AM, Sam wrote: > together with temporaries' lifetime extension to result in quite > flexible code that can survive an otherwise major design change without > really having to change anything. It is not very apparent because it is not what C++ has been designed for. Deterministic control of objects' lifetime is an archetypal component of C++ design, wherein the programmer has full control, and thus responsibility, of object destruction. It seems to me that what you are wishing for here is somewhat closer to a garbage collecting environment wherein you only care of obtaining a reference to an object and you delegate to the language its due destruction. From this perspective it is no surprise that you don't find yourself comfortable with the result. |
Sam <sam@email-scan.com>: Jun 07 01:03PM -0400 Manfred writes: > reference to an object and you delegate to the language its due destruction. > From this perspective it is no surprise that you don't find yourself > comfortable with the result. The lifetime of all of these objects is explicitly defined, and known. There's nothing here that comes anywhere near garbage collection, unless what smart pointers do is also considered to be garbage collection. |
Manfred <noname@add.invalid>: Jun 07 07:25PM +0200 On 6/7/2020 7:03 PM, Sam wrote: > The lifetime of all of these objects is explicitly defined, and known. > There's nothing here that comes anywhere near garbage collection, unless > what smart pointers do is also considered to be garbage collection. I was not referring to smart pointers at all. In your example you wrote your wish for a feature wherein "It doesn't matter" who has ownership of the `available_hours` object - you point out that using a properly qualified reference "the same syntax" should work irrespective of where such ownership sits. This is what GC is for: you get a reference to an object and you don't care about its ownership: you let the language destroy it as soon as (well, soon-ish) all of its references go out of scope. However, in your follow-up you specify that "The lifetime of all of these objects is explicitly defined, and known" - great, all I'm saying is that this doesn't play well with your wish that "It doesn't matter" where ownership is assigned. As a cross reference, see about deterministic finalizers in garbage collected languages, as an attempt to remove the "ish" from above. |
Manfred <noname@add.invalid>: Jun 07 07:36PM +0200 On 6/7/2020 7:25 PM, Manfred wrote: > these objects is explicitly defined, and known" - great, all I'm saying > is that this doesn't play well with your wish that "It doesn't matter" > where ownership is assigned. That said, I don't deny that it could be of interest that this could indeed play well - attempts so far have reached mixed results, IMHO. |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment