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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: How to do multiple instances of a generic packages in automated way. (using ravenscar profile) Date: Thu, 7 Apr 2016 14:36:34 +0200 Organization: A noiseless patient Spider Message-ID: References: <56ff6352-590e-4de7-a361-bc2fec0538fb@googlegroups.com> Reply-To: nonlegitur@futureapps.de Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 7 Apr 2016 12:33:17 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="b96887e80893c84a90c3007226ca0d1c"; logging-data="25297"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+aezFVRkhZE3UnDCAEt9Df7RqSTYxTkLU=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: Cancel-Lock: sha1:gtUnDghmzsKFgMxaKFW7Ipugzc4= Xref: news.eternal-september.org comp.lang.ada:30040 Date: 2016-04-07T14:36:34+02:00 List-Id: On 07.04.16 14:05, danielnorberto@gmail.com wrote: > I will reduce everything to explain the problem better: > > generic > Size_bytes : integer; > package buffer is > protected > put(msg: string); > Entry get(msg : out string); > Private > Content : string(1..size_bytes); > end buffer; It might assist us in isolating issues if you let the compiler check the reduced source text above, or we might incorrectly assume things, including that you might first want to seize the opportunity and get a firm grip of Ada. :-) That being said, with profile Ravenscar active, is there a reason why you can't start from a protected type with a Size discriminant instead of a generic parameter? Is it to do with some version of RavenSPARK in the end? protected type Buffer (Size : Size_In_Characters) is procedure Put (Msg : String); entry Get (Msg : out String); private content : String (1 .. Size); end Buffer; Also note that every String parameter is still allowed to have an unspecified number of characters, whereas content has a maximum number of them, and also that Get has no way to inform its caller about the part of Msg actually filled.