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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,772ae8afc5db35f2 X-Google-Attributes: gid103376,public From: nospam@thanks.com.au (Don Harrison) Subject: Re: Can't export object of private type Date: 1999/02/26 Message-ID: #1/1 X-Deja-AN: 448639317 Sender: news@syd.csa.com.au X-Nntp-Posting-Host: dev7 References: <7b3f6v$lc1$1@nnrp1.dejanews.com> Organization: CSC Australia, Sydney Reply-To: nospam@thanks.com.au Newsgroups: comp.lang.ada Date: 1999-02-26T00:00:00+00:00 List-Id: Robert Dewar wrote: :In article , : nospam@thanks.com.au wrote: :> :Ada doean't allow you to declare a private type and :> declare an object of that :type in the visible part of :> the same spec. For example, the following is :> :illegal: :> : :> : package Private_Stuff is :> : type Private_Type is tagged private; :> : procedure Do_Something (A: in Private_Type); :> : P: Private_Type; :> : private :> : type Private_Type is tagged null record; :> : end; : :This is of course wrong at a very fundamental level. The :notion of linear elaboration is central to the integrity :of the Ada design, and is a notion that should be fully :understood and familiar to Ada programmers. I'm sure you mean that it's wrong that Ada has a linear elaboration model ..and I agree. :) :You mention "looking ahead", and it is of course true that :some trivial cases could be handled this way, but this :never works in the general case. .. [example of recursive declarations] :The point here is that this is not some kind of arbitrary :restriction, .. No, the point here is that recursive declarations don't make any sense ..under any elaboration model. Because *non-recursive* declarations imply a partial ordering, a valid elaboration sequence can be determined for them, irrespective of declaration order. :Now my own design preference would have been to avoid the :separate private part, and just put a private keyword on :selected declarations. I think you're right. In fact, this is the approach used for Eiffel. -- Don (Harrison). donh at syd.csa.com.au