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.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9625801f07d834 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-09 08:06:47 PST Path: supernews.google.com!sn-xit-03!supernews.com!freenix!isdnet!psinet-france!psiuk-f4!psiuk-p4!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: Default expression only allowed for "in" parameters - why? Date: Mon, 9 Apr 2001 10:42:17 -0400 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: <9ashob$q93$1@nh.pace.co.uk> References: <9al9mc$jgk2@cui1.lmms.lmco.com> NNTP-Posting-Host: 136.170.200.133 X-Trace: nh.pace.co.uk 986827339 26915 136.170.200.133 (9 Apr 2001 14:42:19 GMT) X-Complaints-To: newsmaster@pace.co.uk NNTP-Posting-Date: 9 Apr 2001 14:42:19 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: supernews.google.com comp.lang.ada:6661 Date: 2001-04-09T14:42:19+00:00 List-Id: Just a thought: The use of defaults for in-out and out might be more of a matter of interest at the call to the procedure rather than at the procedure itself. With a default specified, the parameter could be ignored. If a procedure passes back a status indication as an out parameter and the caller doesn't care, the caller can ignore it because of the default. (O.K. it looks a little funny - why does an initializer mean you can ignore the parameter? Just because that's how you specify an ignorable parameter when it is an in parameter.) Likewise, if the caller doesn't provide an in-out parameter, one is created with the initial value assigned and then ignored on return. The called procedure goes along fat, dumb and happy not knowing that no actual was provided at the call. I suppose there are other mechanisms possible for saying "this is an ignorable parameter" but since Ada used a default assignment to an in parameter to indicate this, I'd go with it for in-out and out as well. I've seen a number of instances where I've wanted to have parameters to a subprogram that the caller might sometimes want to use and might sometimes choose to ignore. It would be useful to have such a mechanism and might make Ada a little more C-ish {wash out my mouth with soap!} in terms of being able to create subprograms with variable parameter lists. The only reason I could think of for not doing this might be some argument for safety. Is this the sort of thing that would be dangerous to include in the language because of likely programmer errors that could not be detected? I don't know that a case could be made for this, but maybe there is one. (If it is error prone, then wouldn't the ignorable in parameters be likewise dangerous?) 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/ "Ben Brosgol" wrote in message news:GBEMM2.LoD@world.std.com... > If memory serves, the reason for the absence of defaults for 'out' and 'in > out' parameters was methodological. A variable is passed as an [in] out > parameter in order to be modified, and the design team felt that this effect > should be explicit at the point of call, by the explicit presence of an > actual parameter. In any event the capability (of default [in] out objects) > would probably not be too useful, since the default would need to be an > object visible at the procedure declaration whereas it is more typical for > an actual to be local to the scope in which the procedure is called. >