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: border1.nntp.dca1.giganews.com!nntp.giganews.com!news.glorb.com!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!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: Wed, 24 Sep 2014 09:22:47 +0200 Organization: cbb software GmbH Message-ID: References: <4b9c517f-9c78-44f5-bda1-8e7647f06851@googlegroups.com> <14aahny7n1xxq.12aqg1nr0sro0$.dlg@40tude.net> <4a7d6542-d4c1-4d79-8def-d4b74e06dacd@googlegroups.com> <1ow7xs34a7j7z.1f0806cgaoh7r$.dlg@40tude.net> <2bfcf64f-0e19-4cf5-96df-14a360d2cb05@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:189123 Date: 2014-09-24T09:22:47+02:00 List-Id: On Tue, 23 Sep 2014 14:27:01 -0700 (PDT), David Botton wrote: >> Regarding your design. The rule of thumb is that controlled and other >> copyable objects shall not have access discriminants. > > rule of thumb? what would be your reasons to disallow? Because you could return a copy of a local object referencing to another local object [and will have to fight a long losing battle against Ada's accessibility checks]. A copyable object must either carry everything with or else use some collection schema (AKA closure) to prevent premature destruction of their outstanding parts, e.g. reference counted pointers etc. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de