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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cc4f25d878383cc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-10 11:51:51 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.direct.ca!look.ca!wn1feed!wn3feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc53.POSTED!not-for-mail From: "Mark Lundquist" Newsgroups: comp.lang.ada References: <11bf7180.0112070815.2625851b@posting.google.com> <9v0crt$bo2bi$1@ID-25716.news.dfncis.de> <3C14EF19.76C85864@sparc01.ftw.rsc.raytheon.com> Subject: Re: Dimensionality Checking (Ada 20XX) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: NNTP-Posting-Host: 0n8R7-167709-Yy-338672@rwcrnsc53 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc53 1008013910 0n8R7-167709-Yy-338672@rwcrnsc53 (Mon, 10 Dec 2001 19:51:50 GMT) NNTP-Posting-Date: Mon, 10 Dec 2001 19:51:50 GMT Organization: AT&T Broadband Date: Mon, 10 Dec 2001 19:51:50 GMT Xref: archiver1.google.com comp.lang.ada:17704 Date: 2001-12-10T19:51:50+00:00 List-Id: "Wes Groleau" wrote in message news:3C14EF19.76C85864@sparc01.ftw.rsc.raytheon.com... > Mark Lundquist wrote: > > > 2) There's a bad problem with generics. Unit-safe programming totally > > destroys the generic contract model. For example... given this: > > > > generic > > type T is digits <>; > > function F (X, Y : T) return T; > > > > How can you tell if this is legal?: > > I've seen generics that were legal (in the sense of compiling) > but where the compiler was capable of rejecting particular > instantiations. Oh sure, that happens... it's as common as rocks, actually. But the compiler only has to look at the generic *spec* to determine this. What you *never* see today, and what we'd really like to avoid in any language revision, is this: you make a change to the generic *body*, the change is legal (the generic body compiles), but suddenly one or more *instantiations* become illegal as a result. That is the problem I'm talking about with units. Obviously, a solution would be to bring the unit specifications into the contract, i.e. the generic formal part. > I've also seen instantiations where the illegality > was detected at run-time. My memory is fuzzy on the details, though. Not by a conforming implementation :-). RM 1.1.5(3) prohibits an illegality from being detected at "run-time", i.e. by the execution (as defined in 10.2) itself. Certain illegalities can be detected after compilation but before execution (again in the strict sense), but only if they are covered by "post-compilation rules" (1.1.5(4)). But none of the "instatiation errors" you usually see are due to post-compilation rules (there really are not very many post-compilation rules in the standard). -- mark