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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ab12a9b0aa09d6f2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-10-14 05:59:32 PST Newsgroups: comp.lang.ada Path: bga.com!news.sprintlink.net!mhv.net!metro.atlanta.com!emory!sol.ctr.columbia.edu!howland.reston.ans.net!europa.eng.gtefsd.com!newsxfer.itd.umich.edu!gumby!yale!yale!yale.edu!noc.near.net!inmet!dsd!stt From: stt@dsd.camb.inmet.com (Tucker Taft) Subject: Re: saving variant records in sequential files Message-ID: Sender: news@inmet.camb.inmet.com Organization: Intermetrics, Inc. References: <37i7el$4gd@goanna.cs.rmit.oz.au> Date: Thu, 13 Oct 1994 10:46:13 GMT Date: 1994-10-13T10:46:13+00:00 List-Id: In article <37i7el$4gd@goanna.cs.rmit.oz.au>, Hylton Raymond Peimer wrote: >Hi you cool Ada programmer. Take a look at this: > >with sequential_io; > >procedure test is > >type data (info : integer) is record > case info is > when 1 => > a : integer; > b : float; > c : natural; > when 2 => > z : float; > when others => null; > end case; >end record; > >package dat_file is new sequential_io(data); -- (1) > >begin > null; >end test; > >The package I created on line (1) wont compile under Meridian Ada compiler. >It is because I haven't constrained it as: > > package dat_file is new sequential_io(data(1)); That's not legal syntax, but I know what you mean... >or something similar. > >Is Meridian wrong or is this an Ada83/9X feature? In Ada 83, this sort of restriction was tacitly allowed (though discouraged). In Ada 9X, the compiler must support instantiation of Sequential_IO with an unconstrained type like yours. Be that as it may, I suspect your file would be more useful if you gave a default for the discriminant in the definition of the type. Otherwise, when you go to read data back from the file, you will have to know in advance the particular discriminant used to write out each record. In any case, the answer is that Meridian would be "wrong" if it were an Ada 9X compiler ;-). > Hylton Peimer -- s9406722@yallara.cs.rmit.edu.au -- Team Ada! -Tucker Taft stt@inmet.com