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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d74d61525ce986e9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-22 12:41:57 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-FFM2.ecrc.net!news.iks-jena.de!not-for-mail From: Lutz Donnerhacke Newsgroups: comp.lang.ada Subject: Re: Implementing Memorize Date: Wed, 22 Oct 2003 19:41:56 +0000 (UTC) Organization: IKS GmbH Jena Message-ID: References: NNTP-Posting-Host: belenus.iks-jena.de X-Trace: branwen.iks-jena.de 1066851716 21699 217.17.192.34 (22 Oct 2003 19:41:56 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Wed, 22 Oct 2003 19:41:56 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:1462 Date: 2003-10-22T19:41:56+00:00 List-Id: * Dmitry A Kazakov wrote: > wrote: >>* Dmitry A Kazakov wrote: >>> Solution depends on how exposed should be the context used to store >>> results: >>> >>> 1. Completely hidden (allocated upon elaboration of the body) >>> 2. Partially exposed as a generic parameter of the compilation unit >>> 3. Fully exposed as a parameter of the subprogram >> >>It's more or less irrelevant. > > You have to choose an abstraction first. For instance for (1), a > generic variant could be: > > generic > type Argument_Type is private; > type Parameter_Type is private; > with function Evaluate (X : Argument_Type; N : Parameter_Type) > return Argument_Type; > function Evaluate_With_Side_Effects > (X : Argument_Type; N : Parameter_Type) > return Argument_Type; > > function Evaluate_With_Side_Effects > (X : Argument_Type; N : Parameter_Type) > return Argument_Type is > begin > if not then > Evaluate (X, N); > end if; > return ; > end Evaluate_With_Side_Effects; In this case I have reference Evaluate_With_Side_Effects from Evaluate. How can I implement this? > What you wrote is also (1), but on the basis of a tagged type. > Theoretically one could also use a discriminated type, to complete the > list of opportunities. This does not solve the problem of recursion. > precise if the original values were known. The solution here was (3) + > keeping track of original value changes. Understood, but I didn't grasp how to prepare the Evaluate function for this usage.