comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
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
Date: 2017-12-16T22:49:51+01:00	[thread overview]
Message-ID: <p144dv$kkc$1@dont-email.me> (raw)
In-Reply-To: <6bedbdee-ca7f-4d2a-83f9-6cc9c53d21cb@googlegroups.com>

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


  reply	other threads:[~2017-12-16 21:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-16 20:56 how to do things like procedure foo(A: string) is bar: string := A; begin; ...;end; Mehdi Saada
2017-12-16 21:49 ` Jeffrey R. Carter [this message]
2017-12-17 12:40   ` Mehdi Saada
2017-12-17 13:25     ` Jere
2017-12-17 13:49       ` Jere
2017-12-17 13:51     ` Jeffrey R. Carter
2017-12-18 22:22     ` Randy Brukardt
2017-12-18  6:39 ` Robert Eachus
2017-12-18 15:34   ` Mehdi Saada
2017-12-18 17:31     ` Anh Vo
2017-12-18 21:14     ` Robert Eachus
2017-12-19 22:52   ` Robert Eachus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox