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,1ea19776e3073a96 X-Google-Attributes: gid103376,public From: tmoran@bix.com Subject: Re: C/C++ programmer giving Ada95 a chance -- writing an emulator. Date: 2000/03/31 Message-ID: <2YSE4.251$sy6.25957@news.pacbell.net>#1/1 X-Deja-AN: 604581647 References: <38E3DBD7.27F5B246@acenet.com.au> X-Complaints-To: abuse@pacbell.net X-Trace: news.pacbell.net 954465150 207.214.211.201 (Thu, 30 Mar 2000 17:12:30 PST) Organization: SBC Internet Services NNTP-Posting-Date: Thu, 30 Mar 2000 17:12:30 PST Newsgroups: comp.lang.ada Date: 2000-03-31T00:00:00+00:00 List-Id: >And the conversion to Op_Root'Class to force dispatching >seems reasonable to me (you can find this on p546 of Cohen). On p546 Cohen says: > Given (the declaration File_Name_Copy : Heirarchical_File_Name;) > if we were to replace the statement > > This_Delimiter := Delimiter(File_Name'Class(File_Name)); > (he presumably meant to say: > This_Delimiter := Delimiter(Heirarchical_File_Name_Type'Class(File_Name)); > ) > > with > > File_Name_Copy := File_Name; > This_Delimiter := Delimiter(Heirarchical_File_Name_Type'Class(File_Name_Copy)); > > the call on Delimiter would no longer redispatch based on the > tag of File_Name. The assignment to File_Name_Copy throws away > the tag of File_Name, and the call on Delimiter always dispatches > to the Heirarchical_File_Name_Type version of the function. I believe that your assignment > Op_Table : array (Opcode) of Op_Root > := (Op_Root (O0), > Op_Root (O1), > etc likewise throws away the tags of the things copied into spots in Op_Table, and the call on > Func (Op_Root'Class (Op_Table (IR))); always dispatches to the Op_Root version of the function. I think we have here both an error in Gnat and an error in Cohen's book! > It is also obvious my code wouldn't work if the derived types > added components. Exactly.