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,772ae8afc5db35f2 X-Google-Attributes: gid103376,public From: robert_dewar@my-dejanews.com Subject: Re: Can't export object of private type Date: 1999/02/25 Message-ID: <7b3f6v$lc1$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 448272292 References: <7b1k4h$13k6@news3.newsguy.com> X-Http-Proxy: 1.0 x2.dejanews.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Thu Feb 25 12:20:53 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-02-25T00:00:00+00:00 List-Id: 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. 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. Consider for example the following semantic nonsense (which is of course illegal as a special case of the general observation you are making) type x is private; b : x; ... private type x is array (1 .. b'size) of Integer; The point here is that this is not some kind of arbitrary restriction, and it should be like parking in New York City -- "don't even *think* of doing things which violate the notion of linear elaboration" :-) 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 the separation of private parts, nice as it is in the simple cases, has caused SO much confusion, and SO much wasted implementors time (it is a source of lots of implementation difficulty) that it does not begin to be worth it. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own