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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,54aae3da1cf935cd X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews1.google.com!not-for-mail From: mheaney@on2.com (Matthew Heaney) Newsgroups: comp.lang.ada Subject: Re: Ada Singleton Pattern Date: 18 Sep 2004 21:19:17 -0700 Organization: http://groups.google.com Message-ID: <1ec946d1.0409182019.30467e1a@posting.google.com> References: <%Fi1d.245967$OR2.11136154@news3.tin.it> <414CAC2B.60400@y.com> NNTP-Posting-Host: 216.170.141.180 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1095567558 26035 127.0.0.1 (19 Sep 2004 04:19:18 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 19 Sep 2004 04:19:18 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:3838 Date: 2004-09-18T21:19:17-07:00 List-Id: Pylinius wrote in message news:<414CAC2B.60400@y.com>... > Luca Stasio wrote: > > Hi, there is a way to implement the Singleton Pattern in Ada? > > There are some examples out there? > > Thanx. > > package Example_Of_Singleton is > > procedure Do_Something; > > procedure Do_Something_Else; > > end; > > > Bring it on you stupid GangOfFour bastards, with your idiotic bloated > idioms that inculcate and contaminate perfectly good alternative > languages! I alluded to this in my previous post. To be fair, though, you can do this in C++ too: namespace Example_Of_Singleton { void do_something(); void do_something_else(); } One advantage of using a type is if the type is tagged. If there's a singleton instance of type in the class, then you can use that as a value of an object whose type is class-wide. However, most of the time you don't need all of this infrastructure, and the package/namespace technique is perfectly adequate. -Matt