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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,45fb44c5bf432111 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!nf02.dk.telia.net!starscream.dk.telia.net!news.tele.dk!news.tele.dk!small.news.tele.dk!bnewspeer01.bru.ops.eu.uu.net!bnewspeer00.bru.ops.eu.uu.net!emea.uu.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Global scope for instantiated generic package? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <5vWdnTd5Lf6uM-bRnZ2dnUVZ_oidnZ2d@giganews.com> Date: Mon, 30 Aug 2010 15:47:05 +0200 Message-ID: NNTP-Posting-Date: 30 Aug 2010 15:47:05 CEST NNTP-Posting-Host: bf6225a8.newsspool4.arcor-online.net X-Trace: DXC=eUD@2Pm:99MX36K@\WTHGJ4IUK On Mon, 30 Aug 2010 08:12:19 -0500, Trogdor wrote: > I wish to manipulate very large integers with values in the > trillions. This would require a 64 bit integer type, so to maintain > portability I specify a new type using range and let the compiler do > the right thing. > > type BigInt is range 1..10_000_000_000_000; > > I then wish to get and put these values, so I instantiate > Integer_IO. > > package BigInt_IO is new integer_IO(BigInt); > > My program consists of three parts: the main body, a package spec > and a package body (the package containing all the subprograms and > functions). > > 1) Is this the way to do it, or is there a preffered way? I usually do it this way: package Big_Integers is type Big_Integer is range 1..10_000_000_000_000; end Big_Integers; Further instantiations based on it go into children packages: with Ada.Text_IO; use Ada.Text_IO; package Big_Integers.IO is new Integer_IO (Big_Integer); -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de