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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f30ef262af690ce0,start X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!j33g2000pri.googlegroups.com!not-for-mail From: "jhc0033@gmail.com" Newsgroups: comp.lang.ada Subject: numbers as 'generics' parameters Date: Fri, 16 May 2008 10:26:37 -0700 (PDT) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: 75.18.114.21 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1210958797 29192 127.0.0.1 (16 May 2008 17:26:37 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 16 May 2008 17:26:37 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j33g2000pri.googlegroups.com; posting-host=75.18.114.21; posting-account=ZDEUcwoAAAAfEl68GET6fODebgE-CIe2 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:107 Date: 2008-05-16T10:26:37-07:00 List-Id: C++ allows integers as template parameters, so, for example I can define a vector of size N, and verify at compile time that, say, I don't try the inner product of a 2D (N=2) and 3D (N=3) vectors. On the other hand, I don't have to write separate versions of my code for various vector sizes. As far as I can tell, Ada does not allow anything but types as generics parameters, so what would be the approach to use with it? a. code duplication b. keep vector size at runtime (and check)