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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,64fe8f87aae99538 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!m3g2000hsc.googlegroups.com!not-for-mail From: george.priv@gmail.com Newsgroups: comp.lang.ada Subject: Re: How to return an empty aggregate Date: Fri, 4 Apr 2008 16:58:36 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <945217e8-ec37-4a33-9847-28e8e7d55798@59g2000hsb.googlegroups.com> <2c23eecd-d5bf-4320-b0cd-a45b584ddfe3@m36g2000hse.googlegroups.com> NNTP-Posting-Host: 166.129.90.43 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1207353516 16953 127.0.0.1 (4 Apr 2008 23:58:36 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 4 Apr 2008 23:58:36 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: m3g2000hsc.googlegroups.com; posting-host=166.129.90.43; posting-account=VnNb3AoAAACTpRtCcTrcjmPX7cs92k1Q User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:20827 Date: 2008-04-04T16:58:36-07:00 List-Id: On Apr 4, 4:35 pm, Maciej Sobczak wrote: > On 4 Kwi, 17:38, george.p...@gmail.com wrote: > > > Good example is a factory. Should it have a > > mechanism to register-unregister itself? > > Not necessarily. I might be as well selected at startup time by some > other entity (in which case it is also a strategy). > > > In addition such > > objects make sense in singleton form > > Yes and no. > Yes, because it does not make any sense to destroy them and create > again. > No, because it is *not harmful* to destroy and create them again (see > also the monostate pattern): > > F : Factory'Class := Make_Funny_Factory; > Obj : Object := F.Make_Object; > > Above, factory F is a transient entity that is used just to create one > object. It might be a singleton as well, but does not have to. To me it seems that simple callback will be much more simple and clear way to achieve the same result. type Make_Object is access function(Context: Contect_Type) return Object; Obj : object := Make_My_Object(Some_Context_Selector); > > > and likely involve some sort of > > guarding mutexes or be implemented as protected or tasks. > > If it's stateless, then it does not need any protection - there is > nothing to protect. except for reenterance that in most of cases matter for that type of objects. > > > BTW in C++ > > empty factory class will be fine due to implied constructor/ > > destructor. > > The empty factory class will be fine in Ada as well. > > -- > Maciej Sobczak *www.msobczak.com*www.inspirel.com