From: "Nick Roberts" <nickroberts@blueyonder.co.uk>
Subject: Re: What evil would happen?
Date: Sat, 12 Jul 2003 05:31:45 +0100
Date: 2003-07-12T05:31:45+01:00 [thread overview]
Message-ID: <beo2sh$7db25$1@ID-25716.news.uni-berlin.de> (raw)
In-Reply-To: 1LEPa.9034$nP.7178@newsfep4-winn.server.ntli.net
"chris.danx" <spamoff.danx@ntlworld.com> wrote in message
news:1LEPa.9034$nP.7178@newsfep4-winn.server.ntli.net...
> Wojtek Narczynski wrote:
> > Hello,
> >
> > What would happen if a procedure could return a value
> > like a function,
>
> Surely, it would be a function?
I think the idea is that the result returned by the procedure is written
into an implicit variable with a conventional name. Suppose the name is
'Result', then you might have something such as:
procedure P(...) is
begin
...
return X*25.4;
end;
and then:
P(...);
if Result > 200.0 then
...
Some languages which are typeless (and/or fully polymorphic) have this kind
of facility. Nearly all assembly languages essentially work this way (think
of registers). I think it is clear how badly suited it is to a strongly
typed language such as Ada.
Obviously you could simulate the effect by simply writing into a global
variable, e.g.:
Result: Float;
procedure P(...) is
begin
...
Result := X*25.4;
end;
but this is not considered good programming style.
A situation in which it might make sense for Ada to permit a return
statement with an expression in a procedure body is for a procedure which
will be called from a foreign language (and so to which pragma Export
applies). The call in the foreign language may look like a procedure call,
but the language may require a value to be invisibly returned by the
procedure (e.g. indicating success or some kind of failure).
Regarding the parameter modes of functions, I think the main Ada Issue to
refer to is AI-323.
--
Nick Roberts
Jabber: debater@charente.de [ICQ: 159718630]
next prev parent reply other threads:[~2003-07-12 4:31 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-11 19:51 What evil would happen? Wojtek Narczynski
2003-07-11 20:07 ` Hyman Rosen
2003-07-12 12:30 ` Wojtek Narczynski
2003-07-12 17:17 ` Martin Dowie
2003-07-13 1:46 ` Hyman Rosen
2003-07-13 15:29 ` Wojtek Narczynski
2003-07-11 20:08 ` chris.danx
2003-07-12 4:31 ` Nick Roberts [this message]
2003-07-12 12:26 ` Wojtek Narczynski
2003-07-12 12:39 ` Preben Randhol
2003-07-12 13:11 ` Larry Kilgallen
2003-07-12 13:22 ` Preben Randhol
2003-07-12 19:04 ` Larry Kilgallen
2003-07-14 8:43 ` Preben Randhol
2003-07-14 10:32 ` Larry Kilgallen
2003-07-14 11:05 ` Preben Randhol
2003-07-14 11:31 ` Larry Kilgallen
[not found] ` <slrnbh53ir.48d.Organization: LJK Software <zSeTW0M3CTPU@eisner.encompasserve.org>
2003-07-14 17:31 ` Wojtek Narczynski
2003-07-13 15:26 ` Wojtek Narczynski
2003-07-13 17:28 ` Chad R. Meiners
2003-07-13 22:35 ` Wojtek Narczynski
2003-07-14 0:06 ` Chad R. Meiners
2003-07-13 22:36 ` Wojtek Narczynski
2003-07-14 3:01 ` Hyman Rosen
2003-07-14 4:41 ` Chad R. Meiners
2003-07-14 23:32 ` [ot] languages & academia was " chris.danx
2003-07-14 9:09 ` Dmitry A. Kazakov
2003-07-14 17:44 ` Chad R. Meiners
2003-07-14 18:15 ` tmoran
2003-07-15 8:06 ` Dmitry A. Kazakov
2003-07-11 21:26 ` Robert I. Eachus
2003-07-12 12:38 ` Wojtek Narczynski
2003-07-16 0:07 ` Robert I. Eachus
2003-07-16 8:11 ` Preben Randhol
2003-07-14 18:52 ` Randy Brukardt
2003-07-14 20:12 ` Hyman Rosen
2003-07-15 2:32 ` Alexander Kopilovitch
2003-07-15 8:19 ` Wojtek Narczynski
2003-07-15 17:33 ` Randy Brukardt
2003-07-16 0:22 ` Robert I. Eachus
2003-07-16 8:36 ` Dmitry A. Kazakov
2003-07-15 5:16 ` Kenneth Almquist
2003-07-15 11:31 ` Wojtek Narczynski
2003-07-18 8:23 ` Wojtek Narczynski
2003-07-18 14:45 ` Hyman Rosen
2003-07-19 0:55 ` Robert I. Eachus
-- strict thread matches above, loose matches on Subject: below --
2003-07-11 23:04 Beard, Frank Randolph CIV
2003-07-12 12:46 ` Wojtek Narczynski
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox