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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b2436a05996a83c8 X-Google-Attributes: gid103376,public From: "Robert I. Eachus" Subject: Re: Constructing a modular type based on the size of an arbitrary type Date: 1999/09/14 Message-ID: <37DEDD10.9A6939EE@mitre.org>#1/1 X-Deja-AN: 525188270 Content-Transfer-Encoding: 7bit References: <37DE8C45.A40AFE78@ssd.fsi.com> <37DE9983.454243@lmco.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.mitre.org X-Trace: top.mitre.org 937352198 13203 129.83.41.77 (14 Sep 1999 23:36:38 GMT) Organization: The MITRE Corporation Mime-Version: 1.0 NNTP-Posting-Date: 14 Sep 1999 23:36:38 GMT Newsgroups: comp.lang.ada Date: 1999-09-14T23:36:38+00:00 List-Id: Mark A Biggar wrote: > Unfortunately, I beleive the only way to handle this is to move the > burden of defining the appropriate modular type out of the generic > and pass it in as a generic parameter along with the conversion > functions. You don't have to go quite that far. There is no way to pass the modulus as a generic formal, since generic formals are never static. You could declare the modulus in an outer scope, but the best solution is probably to pass in the modulus as an attribute of a generic formal. Huh? Simple example: generic type Modular is mod <>; package Foo is ... type Generic_Mod is new Modular; ... end Foo; At worst this requires declaring a "extra" modular type that is never used elsewhere just before each generic instantiation. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...