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,c0d427d5f4af20f8 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!news.glorb.com!tudelft.nl!txtfeed1.tudelft.nl!feed20.multikabel.net!skynet.be!grolier!oleane.net!oleane!hunter.axlog.fr!nobody From: Jean-Pierre Rosen Newsgroups: comp.lang.ada Subject: Re: generics in Ada 83 Date: Wed, 14 Sep 2005 16:08:28 +0200 Organization: Adalog Message-ID: References: <1126617980.932226.320710@g43g2000cwa.googlegroups.com> <1126703715.202970.293880@g47g2000cwa.googlegroups.com> 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 1126710074 15827 195.25.228.57 (14 Sep 2005 15:01:14 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Wed, 14 Sep 2005 15:01:14 +0000 (UTC) User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: fr, en In-Reply-To: <1126703715.202970.293880@g47g2000cwa.googlegroups.com> Xref: g2news1.google.com comp.lang.ada:4661 Date: 2005-09-14T16:08:28+02:00 List-Id: Hyman Rosen a �crit : > Jean-Pierre Rosen wrote: > >>The benefit is that if a generic compiles, and the instantiation >>provides parameters that match the contract (of the generic formals), >>then the instantion is *always* OK. > > > How is that different from templates? If the template compiles, > and the instantiation provides parameters such that all usage > within the template is legal, then the instantiation is OK. > Otherwise the program doesn't compile. Ada has explicit contracts > and C++ does "contract by usage" but in either language, once the > program compiles it is correct. > In Ada, there is no need to check legality on the expansion of the generic. Correct me if I'm wrong, but my understanding of templates is that the legality is rechecked for each instantiation. -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr