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 Path: border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!goblin3!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Parameterless generic instance in place of opaque type instance Date: Sun, 28 Jul 2013 07:49:36 +0200 Organization: Ada @ Home Message-ID: NNTP-Posting-Host: ds8m8HfAx594C0h4s/JFyA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.16 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 X-Original-Bytes: 2665 Xref: number.nntp.dca.giganews.com comp.lang.ada:182728 Date: 2013-07-28T07:49:36+02:00 List-Id: Hi Ada designers, An idea comes to me from time to time, and it came back to me as a = seducing option for a package, just today. Opaque types are nice, when simple. There are however which requires to = = pull a lot into the private part of a package. Some type may perfectly b= e = singleton, so that a package may just hold all of its state instead of a= = record. Bad practice though, that's a too much sever limitation, when th= e = type is not to be by nature, a singleton. There are types, although they are not singleton by nature, whose instan= ce = may by nature, typically be created sparingly, and not to be stored in = aggregates, I mean, instances of these type are typically not to be hold= = by a record or an array (just to cite these), nor have access (as in = access type) to it. For these types, a parameterless generic instance may be enough. I hope = = most compilers are clever enough to not duplicate machine code for each = of = these instances, and just duplicate their data (valid or invalid = assumption?). Just that I've not seen that pattern too much (to be honest, never), so = I = would like to know if there are people here who already did this and wha= t = can be reported about this pattern on the long run. Good or bad pattern in your opinion? My personal opinion, is that I don't see any issue with it, but to not = have ever seen this done by any one else, make me wonder and wrinkle a = bit, thus this thread here. -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [1] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [1] [1]: Epigrams on Programming =E2=80=94 Alan J. =E2=80=94 P. Yale Univers= ity