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!news2.google.com!postnews.google.com!w21g2000vby.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Discriminants of tagged types Date: Thu, 28 Oct 2010 01:50:51 -0700 (PDT) Organization: http://groups.google.com Message-ID: <14f33f04-40f5-4a72-a18b-d511dd2eb3b3@w21g2000vby.googlegroups.com> References: <14314714-e92c-4036-9cbb-da8e72489261@h7g2000yqn.googlegroups.com> <3243de1d-c6b4-4845-ab5f-28ea4e9f5738@c20g2000yqj.googlegroups.com> NNTP-Posting-Host: 137.138.182.236 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1288255852 12256 127.0.0.1 (28 Oct 2010 08:50:52 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 28 Oct 2010 08:50:52 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: w21g2000vby.googlegroups.com; posting-host=137.138.182.236; 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:14884 Date: 2010-10-28T01:50:51-07:00 List-Id: On 28 Pa=C5=BA, 09:53, "Dmitry A. Kazakov" wrote: > > Because tagged types usually represent entities that are bound to some > > resources > > This has nothing to do with copying. Consider a handle of a resource, e.g= . > HWND as an example. It is bound to the resource, nevertheless it is > copyable. Just like a file descriptor. Yet, there is no reason for these things to be polymorphic. Now consider a window or a file (as opposed to handle or descriptor). They are different from handles and descriptors in that they represent the target resources together with their lifetime management. That is, I expect that finalizing the window object leads to the window being closed or that finalizing the file object leads to the file being flushed and closed, etc. Copy operations for such types are meaningless. What would it mean to copy a file object? Should the file on disk be copied as well? Should the data that is still in the buffer be copied? And so on. Instead of answering these questions in an unsatisfactory way, it is better to outlaw the dubious operation up front. > Rather the opposite, most of container types are not copyiable [*] Is Vector limited? > most of > them are very useful to derive from [**]. I don't see any justification for this. > ** You have to derive in many cases, because, again due to language > limitations, containers are generic, which makes their raw instances > sometimes unusable. Even if they are usable, quite often you would like t= o > hide or reshape something in the container interface and that requires > derivation. I still don't see any justification, the above explanation is circular. Even if you can show an example where a language limitation prevents you from doing something and thus justifies derivation, it is only a proof that the language is broken, and not that the derivation reflects any valid design objective. -- Maciej Sobczak * http://www.inspirel.com