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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,772ae8afc5db35f2 X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: Can't export object of private type Date: 1999/02/28 Message-ID: #1/1 X-Deja-AN: 449648304 Sender: matt@mheaney.ni.net References: <7b1k4h$13k6@news3.newsguy.com> NNTP-Posting-Date: Sun, 28 Feb 1999 13:55:50 PDT Newsgroups: comp.lang.ada Date: 1999-02-28T00:00:00+00:00 List-Id: Samuel Mize writes: > > The best workaround I've been able to come up with is to export an access > > variable to the singleton. For example, > > Let me improve your access-based solution. Changes are in all-caps: > > > package Singleton is > > > > type Singleton_Type is tagged private; Better is to declare this type as limited and indefinite: type Singleton_Type (<>) is limited private; This way, no one can declare instances of the type, nor can they assign another value to the singleton. I'm not clear why the type needs to be tagged. Don't make the type tagged unless you have a compelling reason for doing do. A better solution is to not use a type at all. Just implement the object as a state machine package. I often see programmers using tagged types everywhere. Please do not do this.