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,910a48a538936849 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news3.google.com!news2.volia.net!news.ecp.fr!ciril.fr!oleane.net!oleane!hunter.axlog.fr!nobody From: Jean-Pierre Rosen Newsgroups: comp.lang.ada Subject: Re: how to import a package Date: Thu, 07 Dec 2006 12:21:04 +0100 Organization: Adalog Message-ID: <7ft8le.vk1.ln@hunter.axlog.fr> References: <1165371252.358817.57840@80g2000cwy.googlegroups.com><1165449396.112251.129200@l12g2000cwl.googlegroups.com><1165464845.649851.312700@79g2000cws.googlegroups.com> <4577dc92$1_1@glkas0286.greenlnk.net> NNTP-Posting-Host: mailhost.axlog.fr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: s1.news.oleane.net 1165493165 4984 195.25.228.57 (7 Dec 2006 12:06:05 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Thu, 7 Dec 2006 12:06:05 +0000 (UTC) User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) In-Reply-To: <4577dc92$1_1@glkas0286.greenlnk.net> Xref: g2news2.google.com comp.lang.ada:7849 Date: 2006-12-07T12:21:04+01:00 List-Id: Stuart a �crit : > package body P is > type T is array(0..5) of integer; > A, B : array(0..5) of integer; > C, D : T; > begin > A := B; > -- Not allowed because types don't match! > C := D; > -- Types match! > end P; > > [...] > However, both C and D are of the same named type - even though the type T > has an anonymous type as an index range. I think it is better to avoid > anonymous types - so the declaration of T might be better written as: > type T_index is range 0..5; > type T is array(T_index) of integer; > Just nit-picking, the index type of T is not anonymous, it is Standard.Integer by default, therefore the aboved declaration is not equivalent. Agreed, it is best to avoid hidden use of Standard.Integer. If you need Integer as the index type, better use: type T is array (Integer range 0..5) of Integer; Note that this remark is also applicable to loops. Rather than: for I in 1..10 loop write: for I in Integer range 1..10 loop (small plug: there is a rule in AdaControl to check the above) -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr