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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham 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.189.202 with SMTP id gk10mr1469449pbc.4.1326475391489; Fri, 13 Jan 2012 09:23:11 -0800 (PST) Path: lh20ni178115pbb.0!nntp.google.com!news1.google.com!postnews.google.com!t13g2000yqg.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: How many Ada compiler bugs are here? Date: Fri, 13 Jan 2012 09:23:11 -0800 (PST) Organization: http://groups.google.com Message-ID: 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> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1326475391 18033 127.0.0.1 (13 Jan 2012 17:23:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 13 Jan 2012 17:23:11 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: t13g2000yqg.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-01-13T09:23:11-08:00 List-Id: On Jan 13, 2:00=A0am, "Dmitry A. Kazakov" wrote: > On Fri, 13 Jan 2012 01:35:58 -0800 (PST), AdaMagica wrote: > > On 13 Jan., 10:07, "Dmitry A. Kazakov" > > wrote: > >> On Fri, 13 Jan 2012 00:47:35 -0800 (PST), AdaMagica wrote: > >>> On 13 Jan., 09:23, "Dmitry A. Kazakov" > >>> wrote: > >>>> On Thu, 12 Jan 2012 17:26:34 -0800 (PST), Adam Beneschan wrote: > >>>>> But then again, with extended returns, you don't need to cook up a > >>>>> value. =A0The code: > > >>>>> =A0 =A0 =A0 =A0 =A0-- =A0needed to please the compiler: > >>>>> =A0 =A0 =A0 =A0 =A0return (Ada.Finalization.Limited_Controlled > >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0with others =3D> <>); > > >>>>> could be written more simply as > > >>>>> =A0 =A0 =A0 =A0 =A0return Dummy : T; > > >>>> Not when T requires initialization, i.e. publicly has boxed discrimi= nants. > >>> 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 > =A0 =A0type T (<>) is private; > private > =A0 =A0type T is new Integer; > end P; > > with P; =A0use P; > package Q is > =A0 =A0function Foo return T; > end Q; > > package body Q is > =A0 =A0function Foo return T is > =A0 =A0begin > =A0 =A0 =A0 raise Constraint_Error; > =A0 =A0 =A0 return Dummy : T; -- No, that won't work! > =A0 =A0end Foo; > end Q; > > 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 forc= es > interfaces and package hierarchies reworked. Nasty thing. I think that most likely, if I had a package P that declared a type like this, it would also declare some function (or a deferred constant) to represent some sort of "empty" or "null" or "undefined" value. I guess one could come up with a case where it wouldn't be needed, but I haven't come across one; in my experience, it's *always* been useful to have a value like that that can be used by users of the package. Anyway, having something like that would make the problem moot, in your example. -- Adam