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=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!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!news2.telebyte.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!news-out.tin.it!news-in.tin.it!news4.tin.it.POSTED!not-for-mail From: Luca Stasio User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; it-IT; rv:1.7) Gecko/20040616 X-Accept-Language: it, en, en-us MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada Singleton Pattern References: <%Fi1d.245967$OR2.11136154@news3.tin.it> <14p6ezf3vze8j$.j05arkr066wi.dlg@40tude.net> In-Reply-To: <14p6ezf3vze8j$.j05arkr066wi.dlg@40tude.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Mon, 13 Sep 2004 16:18:36 GMT NNTP-Posting-Host: 80.181.112.238 X-Complaints-To: "Please send abuse reports to abuse@tin.it and technical notifications to newsmaster@tin.it" X-Trace: news4.tin.it 1095092316 80.181.112.238 (Mon, 13 Sep 2004 18:18:36 MET DST) NNTP-Posting-Date: Mon, 13 Sep 2004 18:18:36 MET DST Organization: TIN Xref: g2news1.google.com comp.lang.ada:3689 Date: 2004-09-13T16:18:36+00:00 List-Id: Dmitry A. Kazakov ha scritto: > On Mon, 13 Sep 2004 15:04:27 GMT, Luca Stasio wrote: > > >>Hi, there is a way to implement the Singleton Pattern in Ada? >>There are some examples out there? >>Thanx. > > > package Foo is > type Singleton (<>) is limited private; > ... -- Public interface subroutines > > The_Only_One : constant Singleton; -- The value > private > type Singleton is new Integer; -- Any implementation you want > The_Only_One : constant Singleton := 5; > > The public view of Singleton is unconstrained and limited, which prevents > it from either being copied or declaring new objects of this type. > thanx a lot ;o)