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,bc4137777a63bff X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!news.germany.com!newsfeed.arcor.de!news.arcor.de!not-for-mail Date: Wed, 03 Aug 2005 14:08:19 +0200 From: Georg Bauhaus Organization: future apps GmbH User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Help needed for ada package References: <1122305318.728942.304120@f14g2000cwb.googlegroups.com> <2OudnZo-iL1aN3jfRVn-iQ@comcast.com> <1122475184.849564.159870@g44g2000cwa.googlegroups.com> <1122547648.069514.63520@g14g2000cwa.googlegroups.com> <1122980923.842598.181310@g49g2000cwa.googlegroups.com> <1123069124.562944.246730@o13g2000cwo.googlegroups.com> In-Reply-To: <1123069124.562944.246730@o13g2000cwo.googlegroups.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <42f0b3a6$0$11750$9b4e6d93@newsread4.arcor-online.net> NNTP-Posting-Date: 03 Aug 2005 14:08:06 MEST NNTP-Posting-Host: 5ac4c17f.newsread4.arcor-online.net X-Trace: DXC=GTOaS=1QFKXTkno\?fPDcV:ejgIfPPldTjW\KbG]kaMX]kI_X=5KeaV3l=aicUOf8ZUUng9_FXZ=S>:=P9Ihe`BX@Z?dZ]MOidU X-Complaints-To: abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:3929 Date: 2005-08-03T14:08:06+02:00 List-Id: strictly_mk@hotmail.com wrote: > Thank you for pointing that out, I changed Long_Integer back to integer > and Associates now works with ID. BUT.. > Sorry everyone but I was just told that there is a mistake in the > specification and ID is supposed to read like this type ID is (<>); > Now all the errors I get in to compiler is this > > open_resit.adb:91:50: expected type "ID" defined at open_resit.ads:2 > open_resit.adb:91:50: found type universal integer > > I still am not sure how to use generics properly, what am I supposed to > write and where do I put it? I'm hoping this is the last sort of > problem I have to fix so this thing can finaly compile. You have generic type ID is (<>); package PoP is ... Some of your subprograms inside the package take ID parameters. A discrete type (that's what "(<>)" implies) lets you base array type definitions inside the package on properties of the generic discrete type ID, like so: type Some_Array_Type is array (ID'range) of Some_Type; This is the basically same as type Some_Array_Type is array(ID'first .. ID'last) of Some_Type; 'Range, 'first, and 'last are properties available with every discrete type. Likewise, you can write loops, for k in ID'range loop ... end loop; or some_variable: Some_Array_Type; ... for k in some_variable'first .. some_variable'last loop -- use some_variable(k) here end loop; BTW, there is no need to declare for-loop variables, these are "automatically" declared. So just give up thinking in terms of whatever Integer type you have in mind. Your job, IIUC, is to write code inside a generic that is parameterized by the type "ID". This type is a discrete type, this is all you know, and it is all you need to know.