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=ham 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-06 21:22:04 PST Newsgroups: comp.lang.ada Path: supernews.google.com!sn-xit-03!supernews.com!freenix!sunqbc.risq.qc.ca!news.maxwell.syr.edu!newsfeed.skycache.com!Cidera!news-reader.ntrnet.net!uunet!ash.uu.net!world!news From: "Ben Brosgol" Subject: Re: Default expression only allowed for "in" parameters - why? X-Mimeole: Produced By Microsoft MimeOLE V5.00.2615.200 Sender: news@world.std.com (Mr Usenet Himself) Message-ID: X-Priority: 3 Date: Sat, 7 Apr 2001 04:19:28 GMT X-Msmail-Priority: Normal References: <9al9mc$jgk2@cui1.lmms.lmco.com> NNTP-Posting-Host: world.std.com Organization: The World @ Software Tool & Die X-Newsreader: Microsoft Outlook Express 5.00.2615.200 Xref: supernews.google.com comp.lang.ada:6603 Date: 2001-04-07T04:19:28+00:00 List-Id: Robert A Duff wrote in message news:wccvgohvgv7.fsf@world.std.com... > "Smark" writes: > > > 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? > > If defaults were allowed for 'out' params, I would think it ought to > mean that this is the default variable to pass to the parameter, not a > default initial value for it. I agree with Bob. > In Ada, a default applies if the > parameter is not explicitly given at the call site. Are you saying that > Status should be initialized to OK if the actual parameter is specified? > > Defaults for 'out' params were allowed in Green. I don't know why they > were removed. Perhaps the fact the you and I disagree on what they > ought to mean is a hint. 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. Ben Brosgol Ada Core Technologies brosgol@gnat.com