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: 103376,e92d558e5b77fce2 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.73.229 with SMTP id o5mr14044217pbv.7.1328621191363; Tue, 07 Feb 2012 05:26:31 -0800 (PST) Path: lh20ni270582pbb.0!nntp.google.com!news1.google.com!goblin2!goblin1!goblin.stu.neva.ru!news.tornevall.net!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Building limited types through nested creator functions Date: Tue, 7 Feb 2012 14:25:40 +0100 Organization: cbb software GmbH Message-ID: References: <40048c5a-ecf5-43e6-8c76-a294d0c333d1@l14g2000vbe.googlegroups.com> <45c75d2a-02b4-40b2-b69b-04c6bf7a47a5@t2g2000yqk.googlegroups.com> <57a267ec-b901-401e-b415-ca6d9cf47616@d15g2000yqg.googlegroups.com> <326bcb0a-e37d-4d67-84c2-3d21e3ba3ffe@h6g2000yqk.googlegroups.com> <12ltgmjr08pwh.10sal6ffvej77.dlg@40tude.net> <4f3103b9$0$6560$9b4e6d93@newsspool4.arcor-online.net> 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: 2012-02-07T14:25:40+01:00 List-Id: On Tue, 07 Feb 2012 11:58:01 +0100, Georg Bauhaus wrote: > On 07.02.12 10:10, Dmitry A. Kazakov wrote: > >> The problem is that constructing functions of Ada are no replacement to >> constructors, especially not with limited types. > > Won't constructors have the same issue with limited private types > and no copying? The problem is specific to functions. A function returns a newly created object, fully operational with all bells and whistles. This contradicts to: 1. limited types (non-copyable) 2. abstract types (no instances) 3. information hiding and partially operational objects Constructor copies nothing. It is never called explicitly. No need to worry about visibility issues. It does not promise or expose things which never should come into existence (like creation of an abstract object). It does not allocate memory, so it is much easier to roll back. It is much simpler and, for all, a sound model which cannot be properly annotated with types. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de