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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: how to do things like procedure foo(A: string) is bar: string := A; begin; ...;end; Date: Sat, 16 Dec 2017 22:49:51 +0100 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <6bedbdee-ca7f-4d2a-83f9-6cc9c53d21cb@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 16 Dec 2017 21:49:51 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="4c7be30708eb1896230c470479290b22"; logging-data="21132"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19OGWCzKWyrXcRaKrKdWog7QmkQYptjxq4=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 In-Reply-To: <6bedbdee-ca7f-4d2a-83f9-6cc9c53d21cb@googlegroups.com> Content-Language: en-US Cancel-Lock: sha1:t6mELTQguGHWIDwyc6s3FuSI5ms= Xref: reader02.eternal-september.org comp.lang.ada:49492 Date: 2017-12-16T22:49:51+01:00 List-Id: On 12/16/2017 09:56 PM, Mehdi Saada wrote: > I try to implement something like > procedure foo(A: string) is > bar: string := A; > begin > ... > end; I'm not clear what you're asking, but this is legal Ada. Bar gets its bounds from its initialization expression. I presume that you want to call it with Foo (A => Left.Data & Right.Data); which is also legal. If the only reason for Foo is to have a shorter name, you can also do declare Bar : String := Left.Data & Right.Data; begin ... end; -- Jeff Carter "[T]he [Agile] idea that it's bad to spend an appropriate time at the beginning of the project to clarify the overall requirements and design is nonsense." Bertrand Meyer 149