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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.129.131.212 with SMTP id t203mr9229287ywf.35.1438461865555; Sat, 01 Aug 2015 13:44:25 -0700 (PDT) X-Received: by 10.140.98.117 with SMTP id n108mr82236qge.23.1438461865521; Sat, 01 Aug 2015 13:44:25 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!69no3309408qgl.1!news-out.google.com!b31ni3302qge.0!nntp.google.com!z61no4673263qge.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 1 Aug 2015 13:44:25 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=81.203.145.32; posting-account=AFCLjAoAAABJAOf_HjgEEEi3ty-lG5m2 NNTP-Posting-Host: 81.203.145.32 References: <014427b1-ff7a-4a69-82e6-0330af77ed96@googlegroups.com> <91f88d79-197c-419f-84a8-908e05967a2c@googlegroups.com> <135c2b00-d13c-4f5d-a586-8aca442d363b@googlegroups.com> <87380683vc.fsf@adaheads.sparre-andersen.dk> <347c6be9-c918-4bc0-9494-c93cd6740def@googlegroups.com> <4cb32c40-f659-490d-bbb6-73585fc069e8@googlegroups.com> <7e653a88-e690-431a-9df9-3fc691466e08@googlegroups.com> <25e8deb9-a967-4856-97cb-4257e1ba7fa4@googlegroups.com> <84debe67-b26c-40c6-93ae-a2dec28f081b@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Running a preprocessor from GPS? From: EGarrulo Injection-Date: Sat, 01 Aug 2015 20:44:25 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:27308 Date: 2015-08-01T13:44:25-07:00 List-Id: On Saturday, August 1, 2015 at 7:49:17 PM UTC+2, Jeffrey R. Carter wrote: > I guess we have different definitions of "deficiency." Yours seems to be > something that it is impossible to achieve using the language; if there's a way > to do it, no matter how difficult, complex, and unintuitive, then it's not a > deficiency. By mine, a language that doesn't have a simple, obvious way to > implement common concepts has a deficiency. I would rather say that my definition of "deficiency" does not include different idioms. Ada and C++ have different ways to accomplish encapsulation: Ada encapsulation is accomplished using the Package. C++ encapsulation is accomplished using the Class. [source: http://www.adahome.com/articles/1997-03/ada_vs_cpp.html] > The differences between true modules and the C++ "class" construct have been > hashed over so much that there's no point in me repeating it here. The upshot of > it is that they are not equivalent. If they were, a singleton in C++ would be as > simple and obvious as in Ada. And indeed it is. Your Ada example: if Some_Condition then -- Call operations of Singleton_Package end if; translates directly to C++: if (some_condition) { // Call static operations of Singleton_Class. } Where is the difference? I don't see any. Maybe some C++ constructs are not well understood by Ada programmers. Take this quote, for example: 12. What is the fundamental difference between a C++ class and an Ada package? Ada packages are more generalize [sic] encapsulations that can define any number of types. [see https://stevanussugianto.wordpress.com/2013/06/06/concept-of-programming-languages-chapter-11-abstract-data-types-and-encapsulation-constructs/] But you can define any number of types in C++ classes, too! This is why you can ask a container about the type of its elements; something that the STL exploits heavily; and also something that you can't do in Ada, because the type of the elements of a container are defined in the package that defines the container. > The pkg is a very important concept in Ada, and your insistence that there has > to be a Get_Instance function shows that you don't fully understand it yet. > Until you do, you won't really understand Ada. Actually, I don't see anything esoteric about Ada packages. I have insisted on a Get_Instance function because otherwise the Singleton pattern wouldn't be any different from global variables (or static class members).