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-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Mon, 03 Jul 2006 19:07:23 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <7Q2qg.812592$084.507058@attbi_s22> Subject: Re: Question about generics. Date: Mon, 3 Jul 2006 19:08:07 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-hjG2zCiWc9gQIuH9iLGnJ5kI3EXbEYqbhUAGxTfSR4/FoPWdq2QIrS4FzwLicjSdeB1ax2EAc/ztuUN!uyo3IY6P88oteBZ3x+RVcESrVAwoslmHTwpcIVcHg/i9PhUVDv1NC9KGJC8/dTxEi9CCZIgzmpAM!QidQh6jjVSPjcw== X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:5447 Date: 2006-07-03T19:08:07-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:dv4t30a6porw.1r47tofvyu5ws$.dlg@40tude.net... ... > Right. But it is the problem of Ada, that "static Positive" cannot be > expressed as a [formal] type. If that were possible then the generic unit > could be checked before instantiation. There are also other cases where > that would be useful. For example, for forcing constant folding at compile > time (necessary for statically dimensioned values.) It's not a problem, it's a feature. Repeat after me: a generic is not a macro. A generic is not a macro. A generic is not a macro. Got it yet?? ;-) The legality of a generic body never, ever depends on the actual values used in an instantiation. The legality of a generic spec rarely depends on the actual values. In any case, allowing some sort of static generic parameter would completely prevent any possibility of generic code sharing. It's unlikely that the language would be changed in such a way. (If you don't understand why, just consider putting the bit locations for various types as formal parameters. How would you implement sharing then?) Randy.