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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ada202X: Easy to use "UML private"-like components Date: Tue, 25 Jun 2013 09:21:12 +0200 Organization: cbb software GmbH Message-ID: <12c0h7muc9ab1$.1rn058nrhw3m8.dlg@40tude.net> References: <69246de0-4b33-4d47-b5be-a45e8c911fb0@googlegroups.com> <9qrbs8l828t3pvgves504a8fm7o1c7tcpj@4ax.com> <91qcs81k6am9l3u3n19lj0b072lc48td69@4ax.com> <1im71djlxwm94$.fbjv1si7kmvj$.dlg@40tude.net> <206y6i0kct3w$.mhlovb1s5pey.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: IenaDxMXK2hi7fvYcb+MlQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:15930 Date: 2013-06-25T09:21:12+02:00 List-Id: On Mon, 24 Jun 2013 15:11:11 -0500, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:k32sqc8hss4r$.14d3n8qneksz7$.dlg@40tude.net... > ... >> Maybe they could be augmented in order to deal with more complex kinds of >> parametrization, e.g. for container types (sequence of Integer indexed by >> String). But again, please, without opening up the bodies. >> >> You don't need the body unless you "expand". > > You don't need the body even if you *do* "expand" (as Ada does). The Ada > contract model is strict enough that universal code sharing works (and the > contract model could be stronger still). Here is a logical contradiction. If the model were that strong you would need no bodies to look into, the public part declaration should be enough for using the type. But the model is not enough strong and it is not enough precise. You can write type T is private; and there is no contract put on T'Size. Without that contract you cannot have type A is array (...) of T; etc. Either 1. The contract model should be much more precise and explicit, e.g. with interfaces: -- Not Ada type T is new Abstract_Fixed_Size_Type_Interface with private; overriding function "'Size" (Object : T) return Universal_Integer; or 2. You must have private part available for the compiler to deduce missing information. I prefer both. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de