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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b88383a5d9c51aa0 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder.news-service.com!newsfeed-fusi2.netcologne.de!195.14.215.230.MISMATCH!news.netcologne.de!newsfeed-hp2.netcologne.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Ada-Singleton-Why does it work like this? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <5a7a870c-40e2-4803-8753-0f9cfd2b800f@k2g2000yql.googlegroups.com> <6d2b2c67-22fb-4283-87ab-58357e47d5ca@v39g2000yqm.googlegroups.com> Date: Thu, 26 Mar 2009 15:28:46 +0100 Message-ID: <18883tufqaunz.gf51zy6m6gna$.dlg@40tude.net> NNTP-Posting-Date: 26 Mar 2009 15:28:46 CET NNTP-Posting-Host: 8184829b.newsspool2.arcor-online.net X-Trace: DXC=L0;ih[I5V3UFm0Y?OE@2^XA9EHlD;3YcR4Fo<]lROoRQ^YC2XCjHcbYEL]HnTCTDNcfSJ;bb[UFCTGGVUmh?TLK[5LiR>kgRg73BCTb5VgR X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:5304 Date: 2009-03-26T15:28:46+01:00 List-Id: On Thu, 26 Mar 2009 06:39:26 -0700 (PDT), Maciej Sobczak wrote: > On 26 Mar, 10:28, "Dmitry A. Kazakov" > wrote: > >> This highlights the point. "Singletonness" is not a property of the type >> used to implement it. > > Depends. The type involves not only the set of possible states, but > also the set of possible operations. Is the creation as an operation > part of this set? No, creation is not an operation. Operations are defined on values. A singleton is a variable that can take different values changed by applying corresponding operations. The property of being singleton is one of the variable (object). > Can you defend the idea that creation does not belong to the type? I think I can. Creation cannot be expressed in terms of values of the type. As an example consider integer. There is no integer operation that creates values. In fact, integer values exist outside the program, they always existed before and will exist after any program being written or run. Obviously + does not create a new 4 when 2 is added to 2. Similarly, there is no integer subprogram that creates an integer object (like a variable). That is a prerogative of the compiler which inserts some magic object creation stuff as necessary. This thing is called "constructor." Functions are not constructors, they return "existing" objects. Even newly introduced Pickwickian functions in Ada 2005 do so. That's why return-statement was invented. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de