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, T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b88383a5d9c51aa0 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.germany.com!news.tornevall.net!news.jacob-sparre.dk!pnx.dk!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Re: Ada-Singleton-Why does it work like this? Date: Sun, 29 Mar 2009 09:29:02 +0200 Organization: Jacob Sparre Andersen Message-ID: References: <5a7a870c-40e2-4803-8753-0f9cfd2b800f@k2g2000yql.googlegroups.com> <9a5fb100-c38d-45f6-a482-1c67b26c5866@z15g2000yqm.googlegroups.com> <19a1c6cf-4e4d-402c-902d-3ea2055b4779@c11g2000yqj.googlegroups.com> NNTP-Posting-Host: taasingegade.news.jacob-sparre.dk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: munin.nbi.dk 1238311743 17615 85.82.239.166 (29 Mar 2009 07:29:03 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Sun, 29 Mar 2009 07:29:03 +0000 (UTC) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) Cancel-Lock: sha1:ddPIYCbxL3FGmvfg4goVrZ8/IZw= Xref: g2news1.google.com comp.lang.ada:4379 Date: 2009-03-29T09:29:02+02:00 List-Id: "patrick.gunia@googlemail.com" wrote: > I used a tagged type because I wanted to use the Singleton > implementation as bsae class for other classes with more > functionality though sharing the singleton behaviour. That's a very complicated way of creating singletons, unless of course that you actually have some operations which should work on your whole class of singletons. In general, it is easier to write: package Single_Car is procedure Start; procedur Stop; end Single_Car; package Single_Plane is procedure Start; procedur Stop; end Single_Plane; than it is to write: package Singleton is type Instance (<>) is tagged limited private; ... private ... end Singleton; package Single_Car is type Instance is new Singleton.Instance with private; procedure Start (Item : in out Instance); procedure Stop (Item : in out Instance); private ... end Single_Car; package Single_Plane is type Instance is new Singleton.Instance with private; procedure Start (Item : in out Instance); procedure Stop (Item : in out Instance); private ... end Single_Plane; Greetings, Jacob -- "Very small. Go to sleep" -- monster (not drooling)