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,45fb44c5bf432111 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!138.195.8.3.MISMATCH!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Re: Global scope for instantiated generic package? Date: Mon, 30 Aug 2010 15:25:00 +0200 Organization: Jacob Sparre Andersen Message-ID: <87k4n8utar.fsf@hugsarin.sparre-andersen.dk> References: <5vWdnTd5Lf6uM-bRnZ2dnUVZ_oidnZ2d@giganews.com> NNTP-Posting-Host: 79.138.227.217.bredband.3.dk Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: munin.nbi.dk 1283174703 6204 79.138.227.217 (30 Aug 2010 13:25:03 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Mon, 30 Aug 2010 13:25:03 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:ik++Sd/65da2nTr4Qqv7gTbNceM= Xref: g2news1.google.com comp.lang.ada:13851 Date: 2010-08-30T15:25:00+02:00 List-Id: Trogdor wrote: > type BigInt is range 1..10_000_000_000_000; This has to be done in a declarative region (i.e. inside a package or subprogram). This could be in a completely independent package: -- trogdor.ads (for GNAT) package Trogdor is type Integer is range 1..10_000_000_000_000; end Trogdor; > I then wish to get and put these values, so I instantiate > Integer_IO. > > package BigInt_IO is new integer_IO(BigInt); This can be a complation unit of its own: -- trogdor_io.ads (for GNAT) with Trogdor; package Trogdor_IO is new Ada.Text_IO.Integer_IO (Trogdor.Integer); Or you can put it inside the same package as the number type: -- trogdor.ads (for GNAT) package Trogdor is type Integer is range 1..10_000_000_000_000; package IO is new Ada.Text_IO.Integer_IO (Integer); end Trogdor; > 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? If the subprograms are specific to the program, you may want to declare them in the declarative part of the program rather than in a separate package. Kind regards, Jacob Sparre Andersen -- Jacob Sparre Andersen Research & Innovation Vesterbrogade 148K, 1. th. 1620 K�benhavn V Danmark Phone: +45 21 49 08 04 E-mail: jacob@jacob-sparre.dk Web-site: http://www.jacob-sparre.dk/