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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.180.80.227 with SMTP id u3mr1188388wix.5.1375457774819; Fri, 02 Aug 2013 08:36:14 -0700 (PDT) X-Received: by 10.182.28.129 with SMTP id b1mr18213obh.37.1375457774545; Fri, 02 Aug 2013 08:36:14 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!goblin1!goblin.stu.neva.ru!el7no820435wib.1!news-out.google.com!cc8ni6102wib.1!nntp.google.com!fx3no572139qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 2 Aug 2013 08:36:14 -0700 (PDT) In-Reply-To: <8bef1dc4-547b-478e-b81a-09077212f821@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=63.80.193.9; posting-account=nD_N8QoAAACgNfe5vMwm0rMAu4pgYumJ NNTP-Posting-Host: 63.80.193.9 References: <6238c325-79c5-4537-ba55-2800110dc6df@googlegroups.com> <1wugpqyea6s39$.e2e8eshup5wn$.dlg@40tude.net> <51fadf40$0$6557$9b4e6d93@newsspool4.arcor-online.net> <15qso6tlt3uf1.h45wqc019b00$.dlg@40tude.net> <51fb80d8$0$6561$9b4e6d93@newsspool4.arcor-online.net> <1so729qnkrrj2.ztrxvmlw6cb7.dlg@40tude.net> <8bef1dc4-547b-478e-b81a-09077212f821@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Generics vs. O-O? From: Alan Jump Injection-Date: Fri, 02 Aug 2013 15:36:14 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:16656 Date: 2013-08-02T08:36:14-07:00 List-Id: On Friday, August 2, 2013 8:08:38 AM UTC-7, Shark8 wrote: > > Yet another language design > > problem that there is no simple way to declare such singleton types in = Ada. > Really? > In Ada 2012 I can say the following: > package Test is > Type K is Private; > J : Integer :=3D 12; > private > use type System.address; > type K is new integer with TYPE_INVARIANT =3D> K'Address =3D J'Address; > end test; > > Type K sure looks like a singleton to me. This is going off on a bit of a tangent, but as a new student of the langua= ge, I think a case could be made that many stand-alone packages or procedu= res in Ada are singletons, simply because of Ada's inherent strong typing. = After all, what's a singleton? By definition, to be a singleton pattern, tw= o criteria must be met: one and only one instance with a global point of ac= cess, and initialization on first use. (Source: http://sourcemaking.com/des= ign_patterns/singleton) With that said, and again being a new student of the language, I find mysel= f in favor of generic use, simply from a standpoint of code reuse. A well-d= esigned algorithm that finds itself applied several times within a given pr= ocedure, which varies only in parameter types, should only have to be coded= once. Just my 2p worth...save up the change for a pack of monitor wipes or someth= ing. - - 73 de N5ILN Alan