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!e39g2000hsf.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: How to return an empty aggregate Date: Sat, 5 Apr 2008 06:48: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: 85.3.103.164 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1207403316 20102 127.0.0.1 (5 Apr 2008 13:48:36 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 5 Apr 2008 13:48:36 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: e39g2000hsf.googlegroups.com; posting-host=85.3.103.164; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; 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:20838 Date: 2008-04-05T06:48:36-07:00 List-Id: On 5 Kwi, 01:58, george.p...@gmail.com wrote: > To me it seems that simple callback will be much more simple and clear > way to achieve the same result. It depends where you start with the design. If you start with stateless concrete factories (or you just see the whole picture right from the beginning), then callbacks will seem attractive. But if you start from the user site without knowing up-front what will kind of factory will be used then 'Class is the OO way to solve the problem. What will you do with the callback interface if at some point you discover that stateful factory will be most appropriate? Will you mess around with local functions that manipulate state from their enclosing scope? What about many such factories that have distinct states? And so on. > > 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. If it's stateless, then reentrance is given for free. -- Maciej Sobczak * www.msobczak.com * www.inspirel.com