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,b7dc7082d345b1e1 X-Google-Attributes: gid103376,public From: Ray Blaak Subject: Re: package dependence question Date: 2000/05/30 Message-ID: #1/1 X-Deja-AN: 629159714 Sender: blaak@LANGLEY References: <8gt19i$1cm8@r02n01.cac.psu.edu> X-Complaints-To: news@bctel.net X-Trace: news.bc.tac.net 959718223 209.53.149.68 (Tue, 30 May 2000 13:23:43 PDT) Organization: The Transcend NNTP-Posting-Date: Tue, 30 May 2000 13:23:43 PDT Newsgroups: comp.lang.ada Date: 2000-05-30T00:00:00+00:00 List-Id: Robert A Duff writes: > One thing you can do is declare tagged type Node, and then "type > Node_Ptr is access all Node'Class;". Make types A, B, and C derive from > Node. Then B can have a component like "Parent: Node_Ptr;". You lose > type checking -- the parent of a B is always an A, but the code doesn't > say so, except in a comment. Put the Parent : Node_Ptr in the Node type. Full type checking can be achieved by making the constructors for a B node require an A node as a parent parameter (and in general, a arbitrary node's constructor has a signature in terms of the required parent node). Safety by construction! -- Cheers, The Rhythm is around me, The Rhythm has control. Ray Blaak The Rhythm is inside me, blaak@infomatch.com The Rhythm has my soul.