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!news2.google.com!news.glorb.com!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed10.multikabel.net!news.astraweb.com!border2.a.newsrouter.astraweb.com!feeder2.cambrium.nl!feeder4.cambrium.nl!feeder1.cambrium.nl!feed.tweaknews.nl!news.netcologne.de!nhp.netcologne.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Self pointer in limited record From: Georg Bauhaus In-Reply-To: <1188917721.390096.265690@r29g2000hsg.googlegroups.com> 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> <6u642u4cyw.fsf@hod.lan.m-e-leypold.de> <1188917721.390096.265690@r29g2000hsg.googlegroups.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1188927115.2630.119.camel@kartoffel.vocalweb.de> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Date: Tue, 04 Sep 2007 19:31:55 +0200 Organization: Arcor NNTP-Posting-Date: 04 Sep 2007 19:31:15 CEST NNTP-Posting-Host: 26a8f9d7.newsspool2.arcor-online.net X-Trace: DXC=dFW5bdQZV^kJ00P1S40fZgA9EHlD;3Ycb4Fo<]lROoRa<`=YMgDjhgbV;2FGHD>Zkc=kbmW`a1fGgC`2T@AUZfCkCm`Kn18\=_m X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:1736 Date: 2007-09-04T19:31:15+02:00 List-Id: On Tue, 2007-09-04 at 07:55 -0700, Adam Beneschan wrote: > On Sep 1, 8:33 am, Markus E L > wrote: > > "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. > > > > Not if they are singletons, i.e. objects of which only one instance > > can occur in the program. Then they are better modeled as packages. > > The trouble is, I can think of several occasions in which I assumed an > object could only have one instance---and then later found reason to > wish I had written it so that there could be two. After careful consideration, when I have only two objects, they are almost identical, they are used locally and they don't need to be passed around, I could use generic instances much the same way I could use object instances and distinguished receiver notation. The "almost identical" part of the sentence can turn into a tiny generic formal part or into a Create procedure of the package. (And rewriting can always be done as described by J-P. Rosen in this thread.) Didn't this work reasonably well in Ada 83 for singletons? For me, multiplicity(!) is by default more than 2, like in some natural languages that have special forms for a "multiplicity" of 2. When I can say, 'Many!', it is time to change from single objects to typed instances of the lot. I understand that for a mathematician, multiplicity starts at 0. So the question is, what is the best Ada construct for modeling no object? Packages with or without a type?