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.1 required=5.0 tests=BAYES_40,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!amdcad!ames!pasteur!ucbvax!SEI.CMU.EDU!asp From: asp@SEI.CMU.EDU (Spencer Peterson) Newsgroups: comp.lang.ada Subject: Sample Sequential_Io code Message-ID: <1988.2.15.15.21.2.Alfred.Peterson@sei.cmu.edu> Date: 15 Feb 88 16:11:42 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet List-Id: Here is some sample code that DOES compile correctly on the current version of VAX Ada. with Sequential_Io; procedure Seq_Test is package Sio is new Sequential_Io(Integer); use Sio; f : File_Type; i : integer; begin open( f, in_file , "test.sio"); read( f, i ); close( f ); end; The problem you and the professor had was probably in placing the instantiation of Sequential_Io correctly into one (or more compilation units). The code segment below is equally compilable: with Sequential_Io; package Sio is new Sequential_Io(integer); -- The above makes Sio a valid library generic instantiation, nameable in any -- subsequent compilation unit. with Sio; use Sio; -- the 'use' is LEGAL here, as Sio is no longer a generic. procedure Seq_Test is use Sio; -- If you DON'T use it in the context clause, it's legal here also. ... -- Code is the same, except that the instaniation is not needed. end; By the way, if the prof.'s PC compiler accepted "use Sequential_Io;", then it has a bug(very probably), since a generic package cannot be 'used' directly without a prior instantiation, and the library name "Sequential_Io" is predefined and should ALWAYS refer to the package specified in the ARM, and hence should NOT a library unit nameable in a 'use' clause. Technically, it is NOT illegal to use the predefined library unit names(with an exception that I would explain here) but it would be considered BAD programming style. Spencer Peterson Member of the Technical Staff Software Engineering Institute Carnegie Mellon University 5000 Forbes Ave. Pittsburgh, PA 15213 412-268-7608