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 X-Received: by 10.180.76.76 with SMTP id i12mr1972437wiw.6.1371927955321; Sat, 22 Jun 2013 12:05:55 -0700 (PDT) Path: Xl.tags.giganews.com!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!cw2no17497046wib.0!news-out.google.com!md6ni17437wic.0!nntp.google.com!proxad.net!feeder1-2.proxad.net!news.glorb.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 22 Jun 2013 14:05:54 -0500 From: Dennis Lee Bieber Newsgroups: comp.lang.ada Subject: Re: Ada202X: Easy to use "UML private"-like components Date: Sat, 22 Jun 2013 15:05:58 -0400 Organization: IISS Elusive Unicorn Message-ID: <9qrbs8l828t3pvgves504a8fm7o1c7tcpj@4ax.com> References: <69246de0-4b33-4d47-b5be-a45e8c911fb0@googlegroups.com> X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES MIME-Version: 1.0 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 76.249.22.77 X-Trace: sv3-tdxdXTPi5I2xNJX6z1oqloQkhWG8KMV8/e7K2Yq2/QyAzaY4qE7rnUuC4/K5gx2xj1h41rw2z+esewE!HYlmnnJ5uOlMLxzIwwyEHRd3j/4BG/yYr3CTrI9WNp4+WossZt8kSWRIZu8LU2CFBSfzM0V6bYct!neWGFA5Edj4WOHCgIgEwAq8y8A== X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 4097 X-Received-Bytes: 3736 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Xref: number.nntp.dca.giganews.com comp.lang.ada:182026 Date: 2013-06-22T15:05:58-04:00 List-Id: 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. From "Programming in Modula-2: 3rd, corrected edition" [N. Wirth; 1985 Springer-Verlag], page 169: """ Definition modules imply the use of qualified export. Type definitions may consist of the full specification of the type (in this case its export is said to be transparent), or they may consist of the type identifier only. In this case the full specification must appear in the corresponding implementation module, and its export is said to be /opaque/. The type is known in the importing client modules by its name only, and all its properties are hidden. Therefore, procedures operating on operands of this type, and in particular operating on its components, must be defined in the same implementation module which hides the type's properties. Opaque export is restricted to pointers. Assignment and test for equality are applicable to all opaque types. """ 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. The use of a Modula-2 opaque export doesn't see it as a pointer -- it just a variable of the named type; the implementation module is where it is defined a pointer to some structure. Note that a strict reading of PiM-2 is not defining an "opaque type" but rather an "opaque export" . -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/