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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,a875277ea50f811b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!f37g2000yqn.googlegroups.com!not-for-mail From: Gautier write-only Newsgroups: comp.lang.ada Subject: Re: Record type as generic parameter Date: Thu, 13 Aug 2009 06:34:31 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <2698b15a-7a94-45b5-90af-d0fb5929b1cf@w41g2000yqb.googlegroups.com> NNTP-Posting-Host: 206.122.158.4 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1250170471 5496 127.0.0.1 (13 Aug 2009 13:34:31 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 13 Aug 2009 13:34:31 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: f37g2000yqn.googlegroups.com; posting-host=206.122.158.4; posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.39 Safari/530.5,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7735 Date: 2009-08-13T06:34:31-07:00 List-Id: On 13 Aug., 12:23, Jean-Pierre Rosen wrote: > Any reason why you cannot make a generic package that would *export* > Association and Scenario_Definition No! > (and procedure Fill_Scenarios), Yes! > rather than importing them? So first of all, thanks for the very nice idea! The "Yes!" is because the exporting generic package is in (or withed by) a very low-level, satellite package, DB_Data.Geo, that basically consists in data pumped (once for all) from a database in form of big enumerated types and constant arrays. So it cannot "see" the definitions needed for Fill_Scenarios. But the "No!" is valid as well, considering the types used for defining these scenarios. So the solution is: 1) In the low-level package DB_Data.Geo.Links: generic type Scenario is (<>); package Scenario_framework is -- pairs: type Association is record scen: Scenario; it : Item; end record; -- list of pairs: type Scenario_definition is array(Positive range <>) of Association; end Scenario_framework; package Dept_Xyz is new Scenario_framework (DB_Data.Geo.Dept_Xyz_Scenario); dept_xyz_scenario_definition: constant Dept_Xyz.Scenario_definition:= ( (Scen_abc, Item_56), (Scen_abc, Item_345), (Scen_uvw, Item_12), 2) In the high-level package: generic type Scenario is (<>); with package Framework is new Scenario_framework(Scenario); def: Framework.Scenario_definition; procedure Fill_Scenarios; One instanciation is then: procedure Fill_Dept_Xyz_Scenarios is new Fill_Scenarios( Dept_Xyz_Scenario, Dept_Xyz, dept_xyz_scenario_definition ); That's it! Thanks again _________________________________________________________ Gautier's Ada programming -- http://sf.net/users/gdemont/ NB: For a direct answer, e-mail address on the Web site!