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: a07f3367d7,e55912fa8f040ab5 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!news.in2p3.fr!in2p3.fr!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: GNAT GPL 2009 - issue with floating points? Date: Mon, 12 Oct 2009 18:26:54 -0500 Organization: Jacob Sparre Andersen Message-ID: References: <4acf9ee2$0$23472$426a34cc@news.free.fr> <6d8f169d-5dc8-465c-9368-be91efc2de0f@v15g2000prn.googlegroups.com> <4acfb607$0$412$426a34cc@news.free.fr> <7d4eb248-3730-4bf0-af51-72a062778510@u16g2000pru.googlegroups.com> <4ad02c34$0$9952$426a74cc@news.free.fr> <1x0s4pludozr7$.r1whvkk9abyn$.dlg@40tude.net> <1y6imbz0dijq$.1ofvdwq3q3cz7.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1255390114 2060 69.95.181.76 (12 Oct 2009 23:28:34 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Mon, 12 Oct 2009 23:28:34 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-RFC2646: Format=Flowed; Original Xref: g2news2.google.com comp.lang.ada:8686 Date: 2009-10-12T18:26:54-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:1y6imbz0dijq$.1ofvdwq3q3cz7.dlg@40tude.net... > On Sun, 11 Oct 2009 11:33:04 +0200, Dirk Herrmann wrote: > >> Dmitry A. Kazakov wrote: >>> On Sat, 10 Oct 2009 08:39:47 +0200, Damien Carbonne wrote: >>> >>>> Thanks, now things are clearer. I understand that the compiler can not >>>> determine Real'Size when it compiles the generic package, but when it >>>> is >>>> instantiated, it should have then necessary knowledge. >>> >>> Not if the generic body is shared, rather than expanded. >> >> It seems that the rules for generics are designed to allow sharing. > > They were. > > Presently, I don't know if shared / contracted model is any alive. > Considering: > > generic > type J is interface and I; > package P is > type T is new J with null record; > end P; > > When compiling P you cannot know if the actual for J does not have an > abstract operation which T does not implement. Right, but that is present in Ada 95 as well. That's why all rules are rechecked in the visible part of an instance. In this particular example, the generic is legal, but an instance could be illegal if an operation that requires overriding is inherited. Note that type extensions like this are always illegal in generic unit bodies, so there is no problem with that. The basic principle (as described by the Ada 9x design team) is to "assume the best (and recheck)" in generic specs and "assume the worst" in generic bodies. > Nevertheless one tries to pretend that generics still have some kind of > "contracts". The body has a strong contract, the specification a weaker one. ... > Then the solution is wrong. The desire is not to share bodies, but to have > contracts. With generics this goal is most likely unachievable. Neverhteless, Ada achieves it. Of course, the Ada definition of a generic contract may not match your ideal... Randy.