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,5c89acd494ea9116 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!62.111.101.3.MISMATCH!news.germany.com!storethat.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Sat, 01 Sep 2007 16:15:44 +0200 From: Georg Bauhaus Organization: # User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Self pointer in limited record References: <1183577468.034566.57830@n60g2000hse.googlegroups.com> <1188578849.187422.280620@50g2000hsm.googlegroups.com> <9fy1xoukz1e3$.h574sqmiauri$.dlg@40tude.net> <46d968ee$0$30368$9b4e6d93@newsspool4.arcor-online.net> <137iu0lr82dtb$.wqy3zjz2vr9q.dlg@40tude.net> In-Reply-To: <137iu0lr82dtb$.wqy3zjz2vr9q.dlg@40tude.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <46d972e8$0$30384$9b4e6d93@newsspool4.arcor-online.net> NNTP-Posting-Date: 01 Sep 2007 16:10:48 CEST NNTP-Posting-Host: 6dad527e.newsspool4.arcor-online.net X-Trace: DXC=hUTm=@HTHg?]E=H1Q9`7874IUK Dmitry A. Kazakov wrote: > On Sat, 01 Sep 2007 15:33:09 +0200, Georg Bauhaus wrote: > >> (The true O-O programmer might suggest that we should simply >> pass an additional object-as-module parameter to every >> package subprogram... ) > > Yes, it is better to keep packages stateless. Though by using tagged objects for a module and not a stateful package, you will dismiss a few properties of packages that can be helpful when modeling singleton modules: 1 - If there is just one object in the problem domain a package is a perfect match and will be straight forward, safe, and simple to implement. No need to worry about static and dynamic scopes of module-objects passed around because there is just this one named package for the problem domain object. 2 - Nesting packages is an option, a distinguishing feature of Ada IMO; a package nested inside a subprogram is a simple solution to the life cycle problem of module style objects. For example, when a singleton object is needed only while a subprogram S is executing, why not just create a simple package within S, that is, right where it is needed, and not anywhere else?