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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,4ce5890331a5b529 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!postnews.google.com!c20g2000yqj.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Discriminants of tagged types Date: Wed, 27 Oct 2010 14:13:41 -0700 (PDT) Organization: http://groups.google.com Message-ID: <3243de1d-c6b4-4845-ab5f-28ea4e9f5738@c20g2000yqj.googlegroups.com> References: <14314714-e92c-4036-9cbb-da8e72489261@h7g2000yqn.googlegroups.com> NNTP-Posting-Host: 85.1.243.81 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1288214021 2533 127.0.0.1 (27 Oct 2010 21:13:41 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 27 Oct 2010 21:13:41 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: c20g2000yqj.googlegroups.com; posting-host=85.1.243.81; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:14864 Date: 2010-10-27T14:13:41-07:00 List-Id: On 27 Pa=C5=BA, 18:02, Yannick Duch=C3=AAne (Hibou57) wrote: > > as non-limited tagged types are nonsense anyway. > > Why ? Because tagged types usually represent entities that are bound to some resources and copying them is somewhere between cumbersome and impossible. Communication channels, database connections, etc. In Ada the only types I'm aware of which are tagged and which have justifiable copy semantics are containers - but you might as well argue that there is no reason whatsoever for them to be tagged, which only proves my point. In C++ (which I'm more familiar with) there is a rule of thumb saying that polymorphic types (anything with a virtual function inside) should have disallowed copy operations. As a rule of thumb it works very well and I've yet to see a justifiable counter-example. The same rule of thumb translated to Ada says: tagged types shall be limited. -- Maciej Sobczak * http://www.inspirel.com