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!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ada Singleton Pattern Date: Mon, 13 Sep 2004 17:33:24 +0200 Message-ID: <14p6ezf3vze8j$.j05arkr066wi.dlg@40tude.net> References: <%Fi1d.245967$OR2.11136154@news3.tin.it> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de PP9tgiegUjLO595bkJbgAQPOU0SLW8dph584N1AJsTlryybKM= User-Agent: 40tude_Dialog/2.0.12.1 Xref: g2news1.google.com comp.lang.ada:3685 Date: 2004-09-13T17:33:24+02:00 List-Id: 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. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de