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: buffer1.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Running a preprocessor from GPS? Date: Sat, 1 Aug 2015 10:49:13 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: 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> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Sat, 1 Aug 2015 17:47:40 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="ee44d3db9c41f5ad88d7e8e8f0268f05"; logging-data="6636"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18uA8uMtkbJv892FT+38l57tznBSkfMDzA=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 In-Reply-To: <84debe67-b26c-40c6-93ae-a2dec28f081b@googlegroups.com> Cancel-Lock: sha1:vAx34lO9bLFlDyYQHTZG1XIcWBQ= X-Enigmail-Draft-Status: N1110 Xref: number.nntp.giganews.com comp.lang.ada:194609 Date: 2015-08-01T10:49:13-07:00 List-Id: On 08/01/2015 05:19 AM, EGarrulo wrote: > > But the original point was that the Singleton pattern was conceived to work > around deficiencies in the languages used in the "Design Patterns" book. I > don't see how those languages are deficient in that respect. It is just that > those languages implement the concept differently. What is a package in Ada, > is a class with static methods in C++ and Java, or even a ".c" file in C. The > goal of the "Design Patterns" book was not to describe how to work around > deficiencies in a language, or even to show how to solve some design problems, but to describe but how problems had already been solved and then to establish > a shared vocabulary to improve communication between designers. The "Design > Patterns" book is descriptive, not prescriptive. 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. In this case, a common idiom that is so simple and obvious in Ada that it doesn't even have a name for it (I was creating them for over a decade before I ever encountered the term "singleton" as used in DP) is so difficult, complex, and unintuitive in these other languages that apparently many people can't figure it out on their own, so the "trick" has to be written down for them. 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. 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. -- Jeff Carter "I don't know why I ever come in here. The flies get the best of everything." Never Give a Sucker an Even Break 102