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,b88383a5d9c51aa0 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!j39g2000yqn.googlegroups.com!not-for-mail From: Martin Newsgroups: comp.lang.ada Subject: Re: Ada-Singleton-Why does it work like this? Date: Thu, 26 Mar 2009 02:04:08 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <5a7a870c-40e2-4803-8753-0f9cfd2b800f@k2g2000yql.googlegroups.com> <13su65cm8b5ov$.1198qla32cc3i$.dlg@40tude.net> NNTP-Posting-Host: 20.133.0.8 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1238058248 25440 127.0.0.1 (26 Mar 2009 09:04:08 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 26 Mar 2009 09:04:08 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j39g2000yqn.googlegroups.com; posting-host=20.133.0.8; posting-account=g4n69woAAACHKbpceNrvOhHWViIbdQ9G User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:5299 Date: 2009-03-26T02:04:08-07:00 List-Id: On 25 Mar, 11:17, Jean-Pierre Rosen wrote: > I think there is a contradiction between "class" and "singleton". The > term "class" is used, because it includes a set of objects that are > equivalent for some point of view, i.e. a mathematical equivalence class. > > Now, if the class gathers only one object, the equivalence relationship > does not make much sense... It is a set - it just has a single member. I think Singleton-as-a-type is useful if and only if you wish to retain behavours you can acheive with other classes, e.g it may be useful to mix in "stream-ability" or even polymorphism - e.g. you know you can only have a single modem in your system but you may need to have different modems (e.g. Hayes v. Alcatel. v. whoever). Now in Ada we are used to doing that sort of thing via package renames and compilation options. But perhaps that isn't an option in system where modems can be replaced between power-down/power-ups. Again, we used to seeing a different style of solving that problem in Ada but that's not to say that solutions used in other languages shouldn't be looked at on their own merits. Perhaps the Patterns Working Group of the ACM could provide classic- Ada-style v. GoF-style presentation? Or is it really that defunct? Cheers -- Martin