comp.lang.ada
 help / color / mirror / Atom feed
* p(x: out File_Type)
@ 1996-12-02  0:00 Richard A. O'Keefe
  1996-12-03  0:00 ` Steve Jones - JON
  0 siblings, 1 reply; 2+ messages in thread
From: Richard A. O'Keefe @ 1996-12-02  0:00 UTC (permalink / raw)



Does

	procedure P(...; X: out File_Type)

ever make sense, where File_Type is one of the standard file types
(from Sequential_IO, Direct_IO, or Text_IO)?

I can find no standard procedures with parameters like that in the
Ada 95 LRM.  I do not want to use them myself.  I don't _think_ they
make sense.

But writing
	procedure P(...; X: out File_Type)
when they mean
	procedure P(...; X: in out File_Type)
is a common mistake that our CS1 students make, and they compiler
they use quietly gulps it down with no indication that it is odd.

-- 
Govt saves money by cutting legal aid, guilty plea rates soar;
poverty is a crime!  (See also recent Sci.Am.)
Richard A. O'Keefe; http://www.cs.rmit.edu.au/%7Eok; RMIT Comp.Sci.




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: p(x: out File_Type)
  1996-12-02  0:00 p(x: out File_Type) Richard A. O'Keefe
@ 1996-12-03  0:00 ` Steve Jones - JON
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Jones - JON @ 1996-12-03  0:00 UTC (permalink / raw)



ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe) writes:

> 
> Does
> 
> 	procedure P(...; X: out File_Type)
> 
> ever make sense, where File_Type is one of the standard file types
> (from Sequential_IO, Direct_IO, or Text_IO)?
First place when this would be used is when it conflicts with
a company standards, some detail that functions should be non
destructive operators only.  So you could have a standard function like

procedure Initialise_Recording(Recording_Number   : in INTEGER;
                               Workstation_Number : in NATURAL;
                               Recording_File     : out File_Type);

(The actual names and types of the paramaters have been change to
protect the innocent).

I have seen single out parameters on other occasions, normally to
keep a standard interface (ie 15 procedures doing similar things
all implemented as procedures but 6 have an out parameter).

But the first reason is the one I see most often, to be fair to it
as a rule in standards it seemed to work fairly well on the last
project I was on as it made it clearer where people were doing the
actual work and what was information serving.

[snip]




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-12-03  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-12-02  0:00 p(x: out File_Type) Richard A. O'Keefe
1996-12-03  0:00 ` Steve Jones - JON

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