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!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Extending a third party tagged type while adding finalization Date: Wed, 6 Dec 2017 19:13:44 -0600 Organization: JSA Research & Innovation 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> Injection-Date: Thu, 7 Dec 2017 01:13:44 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="21849"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:49400 Date: 2017-12-06T19:13:44-06:00 List-Id: "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. 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. 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. 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. 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. (Yes, I'm ignoring "=" and ":=" for this definition; arguably, only limited types can be ADTs as everything ought to be explicitly defined [or inherited]. I won't go that far, but the number of implicit operations of an ADT should be very small. A numeric type can never be an ADT, IMHO.). >> The sorts of things that one doesn't want to make controlled also tend to >> be >> the sorts of things that one doesn't want to make private. Ergo, my >> advice >> above. As always, YMMV. > > Initialization and finalization are properties of ADT only when these are > related to its behavior/semantics. The semantics of coordinates does not > require the implementation to provide any initialization or finalization > beyond default. That does not make it less ADT. The Wikipedia definition you give describes a data type (any data type), and thus is useless. I believe that an Ada type has to be private to be an ADT, and thus coordinates (for one example) are best not being described as an ADT. One COULD build a coordinate ADT, but they'd be working a lot harder than necessary, and there would be no possible gain from doing so (the coordinate system of a target system never changes). Randy.