From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,bf608b8936d68540 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.224.42.141 with SMTP id s13mr4989637qae.3.1367833877227; Mon, 06 May 2013 02:51:17 -0700 (PDT) Path: y6ni14085qax.0!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Accessing finalized values Date: Mon, 6 May 2013 11:52:18 +0200 Organization: cbb software GmbH Message-ID: <5ryqq4azptqx.1evdyl7lvwwg2$.dlg@40tude.net> References: <143a8db3-c14b-4983-a481-4b998aea42af@googlegroups.com> <7a248ba5-9fbc-4326-bbb8-eec3c125d455@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: FbOMkhMtVLVmu7IwBnt1tw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2013-05-06T11:52:18+02:00 List-Id: On Sun, 5 May 2013 08:00:18 -0700 (PDT), sbelmont700@gmail.com wrote: > If the whole purpose of Finalize is "to ensure that proper cleanup is > performed prior to the object becoming permanently inaccessible", Finalize is a hack. It is not suitable to play the role of a destructor, though in some cases it could. > but its > perfectly legitimate to access the object after Finalize has been called, That depends on the role Finalize to play. There is no language guarantee for Finalize to act as a destructor, which would mean in particular that no operation of the type T will be called after destruction of T. BTW, this does not imply you could not access operations of its parent types. That happens only after the parent's destructor is done. If you want Finalize to act as a destructor it becomes your responsibility, because the language lend very little support here. > then writing 110% bulletproof code becomes much more complex. How is an > object supposed to free its resources if the resources must still be made > available? It must not, because the language does not require either behavior. E.g. task components are not available after Finalize in the sense that you cannot call to their entry points. Though you still can query some attributes of. As others have pointed out you have to add some additional logic in order to make working better. You will never have a bulletproof code because construction/destruction in Ada is broken/unsupported in too many places. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de