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 Path: border2.nntp.dca1.giganews.com!nntp.giganews.com!newspeer1.nac.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Using Class wide types as factories, is this legit? Date: Tue, 23 Sep 2014 09:23:32 +0200 Organization: cbb software GmbH Message-ID: <14aahny7n1xxq.12aqg1nr0sro0$.dlg@40tude.net> References: <4b9c517f-9c78-44f5-bda1-8e7647f06851@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: yj8+JIQUMOEawvIM7K49kA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: number.nntp.dca.giganews.com comp.lang.ada:189098 Date: 2014-09-23T09:23:32+02:00 List-Id: On Mon, 22 Sep 2014 22:19:32 -0700 (PDT), David Botton wrote: > I have a pattern I have used in the past to make Classwides act as factories for objects. Why not to pass a factory object instead? > This worked in versions of GNAT about a year and a half ago. Is this a > compiler bug or bad Ada? It is hard to say without seeing Initialize, Finalize and Adjust. I would guess that Adjust is wrong, e.g. not making a deep copy of the things killed in Finalize, which may lead to deallocating these twice in the first variant of your code. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de