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,f4e1ae22e5bbdd9f X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Generic in out object parameters Date: 1997/04/19 Message-ID: #1/1 X-Deja-AN: 235962191 References: <33561FCC.C38@gsfc.nasa.gov> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-04-19T00:00:00+00:00 List-Id: Stephen says << generic Default_Expecting : in STRING; Next_Arg : in out NATURAL; -- index of next argument to read procedure Get_String (Item : out Ada.Strings.Unbounded.Unbounded_String; Expecting : in String := Default_Expecting); >> As an example of using in out parameters in generics. Basically what is going on here is that the generic mechanism is being used for partial parametrization. This is particularly convenient in the case of in out parameters, since it is not possible to provide defaults for in out parameters. Essentially the above generic defition and an associated instantiation of it provides default in out parameters. But i wonder if it is convincing. At least in this case? It seems extremely unlikely that one would instantiation Get_String more than once in a program, so why not just make it a package in which the index is a local variable. Well I suppose you could say something about task safety .. still ...