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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,87557ce53b069315 X-Google-Attributes: gid103376,public From: tmoran@bix.com Subject: Re: meaning of "current instance" Date: 1999/11/12 Message-ID: <2hNW3.1742$dp.68215@typhoon-sf.snfc21.pbi.net>#1/1 X-Deja-AN: 547626940 References: <382b8a6f_4@news1.prserv.net> X-Complaints-To: abuse@pacbell.net X-Trace: typhoon-sf.snfc21.pbi.net 942383294 206.170.24.112 (Thu, 11 Nov 1999 21:08:14 PST) Organization: SBC Internet Services NNTP-Posting-Date: Thu, 11 Nov 1999 21:08:14 PST Newsgroups: comp.lang.ada Date: 1999-11-12T00:00:00+00:00 List-Id: >I don't think your program will even compile. Sorry, I tried to simplify more than was possible. This prints "1 1", as seems nice, but unexpected, with one compiler, but "5832148 1" with another compiler. If X.J in function Init is replaced by X.I, then the two compilers give "39190036 1" and "0 1" respectively. I presume either of X.I or X.J in function Init is erroneous, right? Is the Init function allowed only to reference previously initialized values (ie, X.I could be referenced by Init in "J : Integer := Init(T'access);"), or can it reference any values (seems impossible) or are there no references at all to initial values of the current instance that are legal? package junk1 is type T is private; procedure dump(X : in T); function Init(X : access T) return Integer; private function Stepper return Integer; type T is record I : Integer := Init(T'access); J : Integer := Stepper; end record; end junk1; with ada.text_io; use ada.text_io; package body junk1 is Current : Integer := 0; function Stepper return Integer is begin Current := Current+1; return Current; end Stepper; function Init(X : access T) return Integer is begin return X.J; -- or X.I end Init; procedure dump(X : in T) is begin put_line(Integer'image(X.I) & Integer'image(X.J)); end dump; end junk1; with junk1; procedure junk2 is x : junk1.T; begin junk1.dump(x); end junk2;