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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a1a7a64f0d47e271,start X-Google-Attributes: gid103376,public From: m-bartz@memphis.edu (Michael Bartz) Subject: [Q]: Generic subprogram instantiation Date: 1996/07/05 Message-ID: #1/1 X-Deja-AN: 163885449 organization: The University of Memphis newsgroups: comp.lang.ada Date: 1996-07-05T00:00:00+00:00 List-Id: I am trying to create an instantiated subprogram within a declarative block of a main subprogram. I want to pick the particular instantiation at run-time so I put the declarative block within one of the choices within a case statement. I am instatiating the subprograms so that each particular subprogram can pick up some instantiated packages unique to each particular choice (of the case statement). The problem is that GNAT flags this arrangement with the following: main.adb:26:09: "sub_main" is hidden within declaration of instance main.adb:33:09: "sub_main" is hidden within declaration of instance On surface inspection, I am not sure I understand exactly why the compiler has flagged this? Can anyone explain this error message for me in the context of the program fragments below? I will send full sources if required. --main.adb with all_field_types; use all_field_types; with sub_main; with field; with text_io; use text_io; procedure main is N : Positive := 8; package int_io is new integer_io(Integer); begin case N is when 8 => declare package galois is new Field(GF8_types); procedure sub_main is new sub_main(galois); begin sub_main(N); end; when 16 => declare package galois is new Field(GF16_types); procedure sub_main is new sub_main(galois); begin sub_main(N); end; when others => null; end case; end main; --sub_main.adb procedure sub_main(Z:Integer) is use local_field; X : Field_Element := 1; A : Boolean; begin A := Value(0); end sub_main; --sub_main.ads with field; generic with package local_field is new field (<>); procedure sub_main(Z:Integer); -- Michael Bartz Proud Member of Team Ada(95) The University of Memphis m-bartz@memphis.edu