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!i17g2000vbq.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Discriminants of tagged types Date: Thu, 28 Oct 2010 01:38:03 -0700 (PDT) Organization: http://groups.google.com Message-ID: <7a3efc5b-7475-45cb-abb2-49f88f8581ec@i17g2000vbq.googlegroups.com> References: <14314714-e92c-4036-9cbb-da8e72489261@h7g2000yqn.googlegroups.com> <3243de1d-c6b4-4845-ab5f-28ea4e9f5738@c20g2000yqj.googlegroups.com> <877hh3qqhf.fsf@ludovic-brenta.org> 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 1288255083 5506 127.0.0.1 (28 Oct 2010 08:38:03 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 28 Oct 2010 08:38:03 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: i17g2000vbq.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:14882 Date: 2010-10-28T01:38:03-07:00 List-Id: On 27 Pa=C5=BA, 23:23, Ludovic Brenta wrote: > Funny, I usually do the exact opposite. > > I usually represent these things with untagged limited types. =C2=A0Why w= ould > these objects need to be tagged? In my systems these are tagged to allow different implementations. A database connection will be implemented differently for Oracle and for PostgreSQL, although they may share a common interface. Streams are good examples from the Ada standard library. >=C2=A0Conversely, my tagged types do not > necessarily (or usually, for that matter) represent resources; they > represent data with behavior or GUI widgets. GUI widgets are in the same category for me. They represent something from outside of the program - copying windows objects is meaningless, so it is safer to forbid copying whatsoever by making these types limited. I did not have to use types that are polymorphic and naturally copyable. -- Maciej Sobczak * http://www.inspirel.com