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,cea03ed275aa3d28 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!tiscali!newsfeed1.ip.tiscali.net!proxad.net!proxad.net!oleane.net!oleane!hunter.axlog.fr!nobody From: Jean-Pierre Rosen Newsgroups: comp.lang.ada Subject: Re: Question about generics. Date: Mon, 03 Jul 2006 13:42:16 +0200 Organization: Adalog Message-ID: References: <7Q2qg.812592$084.507058@attbi_s22> NNTP-Posting-Host: mailhost.axlog.fr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: s1.news.oleane.net 1151928065 12672 195.25.228.57 (3 Jul 2006 12:01:05 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Mon, 3 Jul 2006 12:01:05 +0000 (UTC) User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) In-Reply-To: Xref: g2news2.google.com comp.lang.ada:5429 Date: 2006-07-03T13:42:16+02:00 List-Id: Peter C. Chapin a �crit : > "Jeffrey R. Carter" wrote in > news:7Q2qg.812592$084.507058@attbi_s22: > >> Peter C. Chapin wrote: >>> generic >>> Size : in Integer; >>> package Xyzzy is >>> type Index is mod Size; >>> -- etc. >>> end Xyzzy; >> What does a Size of -7 mean? > > Why not a compile time error when the instantiation is attempted? > Because in Ada, legality is checked when the generic is compiled. *If* the generic compiles, and *if* parameters in the instantiation match the formals, *then* the instantiation is guaranteed to be correct, without rechecking the expanded form. This is a useful and important difference from C++ templates. -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr