comp.lang.ada
 help / color / mirror / Atom feed
From: "Marin David Condic" <marin.condic.auntie.spam@pacemicro.com>
Subject: Re: Default expression only allowed for "in" parameters - why?
Date: Mon, 9 Apr 2001 10:07:18 -0400
Date: 2001-04-09T14:07:19+00:00	[thread overview]
Message-ID: <9asfmn$phu$1@nh.pace.co.uk> (raw)
In-Reply-To: 9al9mc$jgk2@cui1.lmms.lmco.com

The rationale AFAIK probably had to do with the fact that one could treat an
in parameter as a constant and provide constants or function calls as
actuals. With out or in-out, you've got to provide a variable so there
seemed to be less justification for default values.

IMHO, since you can define some kind of legitimate, predictable behavior for
in-out and out parameters with a default value, it probably should have been
done just for orthogonality. I've run into situations where it would have
been useful to have. There may be some technical reason for having left it
out, but offhand I can't think of one.

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


"Smark" <not.provided@all.com> wrote in message
news:9al9mc$jgk2@cui1.lmms.lmco.com...
> LRM 6.1(19):
>     A default_expression is only allowed in a parameter_specification
>     for a formal parameter of mode in.
>
> I recently had a situation in which it was desirable for me to have
> a default value for an "out" parameter of a function.  It was something
> like:
>
> procedure Do_Something (Data   : in Some_Type;
>                         Status : out Status_Type);
>
> Normally, Status = Ok.  It seemed to me that, rather than setting
> Status := Ok at the beginning of my procedure, it would make sense to
> just set the default value in the procedure spec.  That is:
>
> procedure Do_Something (Data   : in Some_Type;
>                         Status : out Status_Type := Ok);
>
> It also seemed like a strange idea, because I never recalled seeing
> it done.  Sure enough, it is prohibited by the LRM.  What is the
> rationale for this?
>
> TIA,
> Mark
>
>





      parent reply	other threads:[~2001-04-09 14:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-06 20:41 Default expression only allowed for "in" parameters - why? Smark
2001-04-06 21:30 ` Corey Ashford
2001-04-06 21:49 ` Robert A Duff
2001-04-07  4:19   ` Ben Brosgol
2001-04-09 14:42     ` Marin David Condic
2001-04-09 15:08   ` Smark
2001-04-10 13:59     ` Martin Dowie
2001-04-07 14:12 ` Charles H. Sampson
2001-04-07 18:17   ` Ben Brosgol
2001-04-09 14:07 ` Marin David Condic [this message]
replies disabled

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