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,7a3b1c6915ea1273 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.197.100 with SMTP id it4mr634355pbc.5.1326454571848; Fri, 13 Jan 2012 03:36:11 -0800 (PST) Path: lh20ni177238pbb.0!nntp.google.com!news1.google.com!goblin3!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: How many Ada compiler bugs are here? Date: Fri, 13 Jan 2012 12:35:51 +0100 Organization: cbb software GmbH Message-ID: <1swdtf9umcv6h.1abrhg4hr4tdd$.dlg@40tude.net> References: <01dd6341-9c3c-4dcb-90f8-6ac66c65eb66@z1g2000vbx.googlegroups.com> <98adc34c-deed-4190-9e10-755cb886984f@n39g2000yqh.googlegroups.com> <5cm1d9xlavps$.1tjtc88r9ze21$.dlg@40tude.net> <6d352870-d204-4137-a562-5a0b67db1f80@h13g2000vbn.googlegroups.com> <15d37z3l8zllg$.3z2pj9cy5kvq.dlg@40tude.net> <7610c0ee-db98-4530-afab-f29e187ee7d0@h3g2000yqe.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="iso-8859-1" Content-Transfer-Encoding: 8bit Date: 2012-01-13T12:35:51+01:00 List-Id: On Fri, 13 Jan 2012 02:52:29 -0800 (PST), AdaMagica wrote: >>>>> Of course this is legal since it's in the scope of the full view (it's >>>>> a definite type in the full view, an indefinite only in the partial >>>>> view). >> >>>> Only if you have that full view in the function body. >> >>> What do you want to say? Isn't that exactly what I said? >> >> package P is >> � �type T (<>) is private; >> private >> � �type T is new Integer; >> end P; > > That's a severe design mistake. You cannot declare objects of T - > there are no constructors. P could have a constructing function, but that would not make the return statement in Q legal. Note, my point was that the workaround Adam suggested does not always work in the real-life code. >> The requirement to have a meaningless return might turn to be a serious >> trouble. The example above might look constructed, but things like this >> happen relatively frequently in large projects. And when they do, it forces >> interfaces and package hierarchies reworked. Nasty thing. > > Well, yes, design errors happen. Everyone knows that... An unreachable return required by the language is certainly a design error. But I suggest that you are rather trying to excuse Ada's sloppiness in this issue. If they wanted to be adamant on requiring return, they should have allowed raising return, e.g. function Foo return T is begin return raise Constraint_Error; end Foo; > But this example is a silly mistake. You know that. Where do you see any mistake? I omitted constructing functions because, firstly, they are irrelevant to the point I am making, and, secondly, because factories could be provided by other packages, not necessarily by P itself. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de