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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!mx05.eternal-september.org!feeder.eternal-september.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Ada202X: Easy to use "UML private"-like components Date: Sun, 23 Jun 2013 01:57:17 +0300 Organization: Tidorum Ltd Message-ID: References: <69246de0-4b33-4d47-b5be-a45e8c911fb0@googlegroups.com> <9qrbs8l828t3pvgves504a8fm7o1c7tcpj@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: individual.net 9T1m7SwOt/2koJUc9vWavwluPA3xjkQ0l0xG1hkf02ncWyohn8 Cancel-Lock: sha1:QvV+I/fu02NJRybZ2qNJZuVwt4o= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 In-Reply-To: <9qrbs8l828t3pvgves504a8fm7o1c7tcpj@4ax.com> Xref: news.eternal-september.org comp.lang.ada:15896 Date: 2013-06-23T01:57:17+03:00 List-Id: On 13-06-22 22:05 , Dennis Lee Bieber wrote: > On Sat, 22 Jun 2013 19:41:00 +0300, Niklas Holsti > declaimed the following: > >> >> "The corresponding implementation module must contain a full type >> declaration for any opaque types declared in the definition module. The >> full type declaration must define a pointer type." >> >> I take this to mean that a Modula-2 opaque type uses indirection through >> a pointer type, just as the "stt access types" in Ada, and unlike Ada >> private types in general. > > I suspect that limitation comes about as lacking any knowledge of a > structure, only the type name, the compiler doing the import has to make > assumptions about the storage space of the type -- only a pointer would > have a common, preknown, storage size for all imported opaque types. Of course. The same consideration applies to the Ada "stt access type". > Ada puts the details of the "hidden" part into the specification, where > the compiler is capable of determining required space and generating > instructions to copy (assign) or otherwise manipulate the structure -- even > while preventing the programmer importing the specification from taking > advantage of that knowledge. For private types, yes; for "stt access types", the details of the accessed type are deferred to the package body, as for Modula-2 opaque types/exports. > The use of a Modula-2 opaque export doesn't see it as a pointer -- it > just a variable of the named type; Just as for an Ada private type which (in the private part of the spec) is completed as an "stt access type". I think this is the usual way in which "stt access types" are used in Ada: their "access" nature is not made public. > the implementation module is where it is > defined a pointer to some structure. But, since Modula-2 allows only pointer types to be opaque, the Modula-2 compiler knows that the type is a pointer even when compiling the definition module and before compiling the implementation module. Just as for Ada "stt access types". Maybe my post was unclear: I tried to contradict Bob Duff's recollection that an opaque type in Modula-2 is more like an Ada private type than like an "stt access type". I think that a Modula-2 opaque type is very similar to an "stt access type". Do you agree with me? -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .