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,a00006d3c4735d70 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-01-08 19:49:09 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newspeer1.nwr.nac.net!newspeer.monmouth.com!news.monmouth.com!shell.monmouth.com!not-for-mail From: ka@sorry.no.email (Kenneth Almquist) Newsgroups: comp.lang.ada Subject: Re: Certified C compilers for safety-critical embedded systems Date: 8 Jan 2004 22:49:02 -0500 Organization: A poorly-installed InterNetNews site Message-ID: References: <3fe00b82.90228601@News.CIS.DFN.DE> <3ff9df16.30249104@News.CIS.DFN.DE> <3FFC0201.6020303@noplace.com> NNTP-Posting-Host: shell.monmouth.com Xref: archiver1.google.com comp.lang.ada:4239 Date: 2004-01-08T22:49:02-05:00 List-Id: Robert A Duff wrote: > During the Ada 9X project, some folks suggested making [the random > number generator subprogram be] a procedure. > This was considered a non-starter, primarily because Fortran uses a > function, and that's what people expect. It is rather strange that > (some of) the same language designers who choked at the idea of making > Random a procedure were adamant about forbidding 'in out' params. A quote about eating your own dog food comes to mind here... It's not just expectations created by other languages which are a problem here. A few years ago I wrote a package which looked in part like: package Buffered_IO is type Buffered_Input is tagged abstract limited private; -- A buffered input object reads data in large blocks for -- efficiency, similar to the C standard I/O library or the -- C++ "istream" type. To read an input source, you first -- declare and initialize a type derived from Buffered_Input; -- The details of how you do this depend on where the data -- is coming from; see the child packages of Buffered_IO for -- details. However, once an input source is opened, you can -- read it like you would expect: procedure Get(File : in out Buffered_Input'class; Item : out Character); pragma inline(Get); procedure Get(File : in out Buffered_Input'class; Item : out String); function End_Of_File(File : in out Buffered_Input'class) return Boolean; Oops, that last declaration is illegal. But am I seriously going to ask Ada programmers to write code like: loop End_Of_File(Input, EOF); exit when EOF; ... end loop; I don't think so. So I changed the paramter mode of End_Of_File to "in", and used by GNAT to implement Ada.Numerics.Discrete_Random to allow the parameter to be used like an "in out" parameter. Kenneth Almquist