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!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Extending a third party tagged type while adding finalization Date: Thu, 7 Dec 2017 09:36:30 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <4db43571-7f86-4e73-8849-c41160927703@googlegroups.com> <6496a10f-c97e-4e42-b295-2478ad464b2f@googlegroups.com> <6106dfe6-c614-4fc1-aace-74bf8d7435e3@googlegroups.com> <24767ee5-cda8-45e4-98d1-7da44757bd40@googlegroups.com> <037e7f02-9149-4648-b7c5-91f67c1c1961@googlegroups.com> NNTP-Posting-Host: MyFhHs417jM9AgzRpXn7yg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 X-Notice: Filtered by postfilter v. 0.8.2 Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:49402 Date: 2017-12-07T09:36:30+01:00 List-Id: On 07/12/2017 02:13, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:p07343$1tst$1@gioia.aioe.org... >> On 2017-12-05 22:09, Randy Brukardt wrote: > ... >> I don't know your definition of ADT, but mine is in agreement with >> Wikipedia: >> >> "In computer science, an abstract data type (ADT) is a mathematical model >> for data types, where a data type is defined by its behavior (semantics) >> from the point of view of a user of the data, specifically in terms of >> possible values, possible operations on data of this type, and the >> behavior of these operations. This contrasts with data structures, which >> are concrete representations of data, and are the point of view of an >> implementer, not a user." > > Mathematical model? By that definition, I'll never write an ADT. Of course you do. There is no way any computer implementation to have no mathematical model. Unless you are working with a jigsaw on your computer box ... Programming is not science, not even much an applied science. It has no truths of its own. > The above > is much too complex. It could be simplified a lot: > > An ADT is a data type (from the perspective of a client of a type) defined > solely by the operations defined for that data type. 1. That does not apply to Ada since it has named type matching. Therefore you can have two different types with identical operations. 2. You cannot do anything with a type otherwise than through its operations. So the definition would be useless without splitting operations into "operations operations" and not "quite operations", which you apparently trying to do. > For Ada, this means that an ADT is a private type (possibly tagged) with > (usually explicit) primitive operations, and that there are no end-runs on > those primitive operations. All other uses of the ADT are built out of those > primitives. Why does it follow? 1. Private type means that parts of the representation is hidden. Your definition is not related to that. 2. Primitiveness of an operation is not related either. > If a type is not private, it cannot be an ADT, as it provides an unlimited > number of other operations that are not described explicitly. How primitiveness changes that? I still can define new subprograms taking and returning values of the type regardless. Adding new operations does not alter the semantics of ADT. Overriding could. > With the > Wikipedia definition above, every Ada data type is an ADT, since every type > can be described this way (every operation on a numeric type is described by > the Ada Standard, after all, and a client can use nothing else). That's a > completely useless definition. ADT is the semantics it implements. You first have the semantics (mathematical model of the problem space) and then an implementation of. Non-ADT is ad-hoc semantics deduced from a given representation. You take 'int' from the compiler and then try to figure out if it can be useful for you. That is the difference. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de