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,e9442435fdfe0d3d X-Google-Attributes: gid103376,public From: Samuel Tardieu Subject: Re: Generic Packages Date: 1996/03/22 Message-ID: #1/1 X-Deja-AN: 143734282 sender: tardieu@gargantua.enst.fr references: <4inq3c$lr9@NNTP.MsState.Edu> <4iugrr$r4h@newsbf02.news.aol.com> content-type: text/plain; charset=iso-8859-1 organization: TELECOM Paris mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-03-22T00:00:00+00:00 List-Id: >>>>> "John" == John Herro writes: John> generic formal parameter is treated as a constant in any John> case. For this reason you can't declare John> generic John> Number : constant Integer; John> package P is ... Mmm... I think you are wrong. The reason which prevents you from modifying Number in your first example is that the "in" keyword is ommitted. A generic formal may be either "in" or "in out" (of course, not "out" only). So you may do: generic Number : in out Integer; package G is procedure Increment; end G; package body G is procedure Increment is begin Number := Number + 1; end Increment; end G; with G; with Text_IO; use Text_IO; procedure T is I : Integer := 5; package P is new G (I); begin Put_Line (Integer'Image(I)); P.Increment; Put_Line (Integer'Image(I)); end T; and it will print: 5 6 Sam -- "La cervelle des petits enfants, ca doit avoir comme un petit gout de noisette" Charles Baudelaire