🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.ada
Article #994

Re: Quite Limited!

#994
From: Geoff Mendal
Date: Fri, 03 Oct 1986 11:27
29 lines
1630 bytes
Concerning mode 'out' on limited formals not defined in
the package spec where the limited type is defined...

The reason for this restriction has to do with data integrity.
Consider the following (semantically invalid) compilation unit:

  with Text_Io;
  procedure Destroy_File (File : out Text_Io.File_Type) is
  begin
    null;
  end Destroy_File;

If pass by reference is used, no problem.  But if pass by copy is
used, watch out: the copy back rule will result in a junk value being
assigned to the actual parameter.  The restriction is meant to
preserve data privacy, and thwart attempts to destroy "limited" values
without the defining package knowing about it.

Note that for mode 'out' parameter associations, copy-in is not required
except for some esoteric cases (see references below).  This is an
important difference between mode 'out' and 'in out'.  In any case,
the fix to your program is simple: use mode 'in out' instead of 'out'.

References:
  LRM: 6.2(6 .. 7); 7.4.4(4)
  Barnes, "Programming in Ada": pp. 125, 132, 340

gom
-------
Technical Details
Message-ID: <12243822862.9.MENDAL@Sierra.Stanford.EDU>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!elbereth!rutgers!nike!ucbcad!ucbvax!SIERRA.STANFORD.EDU!Mendal

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!elbereth!rutgers!nike!ucbcad!ucbvax!SIERRA.STANFORD.EDU!Mendal
From: Mendal@SIERRA.STANFORD.EDU (Geoff Mendal)
Newsgroups: net.lang.ada
Subject: Re: Quite Limited!
Message-ID: <12243822862.9.MENDAL@Sierra.Stanford.EDU>
Date: Fri, 3-Oct-86 07:27:44 EDT
Article-I.D.: Sierra.12243822862.9.MENDAL
Posted: Fri Oct  3 07:27:44 1986
Date-Received: Sat, 4-Oct-86 12:44:15 EDT
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The ARPA Internet
Lines: 29