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!r14g2000yqa.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Discriminants of tagged types Date: Sun, 31 Oct 2010 14:06:55 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <14314714-e92c-4036-9cbb-da8e72489261@h7g2000yqn.googlegroups.com> <3243de1d-c6b4-4845-ab5f-28ea4e9f5738@c20g2000yqj.googlegroups.com> <14f33f04-40f5-4a72-a18b-d511dd2eb3b3@w21g2000vby.googlegroups.com> <3c44f6d7-7ff0-4362-8902-fbcfe0eee788@a37g2000yqi.googlegroups.com> <4b0e9629-5a2b-446f-a1bc-d3432db74f13@d8g2000yqf.googlegroups.com> NNTP-Posting-Host: 85.1.63.81 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1288559215 9901 127.0.0.1 (31 Oct 2010 21:06:55 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 31 Oct 2010 21:06:55 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r14g2000yqa.googlegroups.com; posting-host=85.1.63.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:15071 Date: 2010-10-31T14:06:55-07:00 List-Id: On 31 Pa=C5=BA, 19:36, Shark8 wrote: > I got one for you; I was using tagged types to implement the typing- > system for a PostScript interpreter. Yes, this is a good example. But then - do we consider assignment to be part of the "copyability" property? That is, it might be meaningful for your objects to be cloned (duplicated), but is it also meaningful for them to be assigned to one another? Is the assignment meaningful only within the same type, or across the hierarchy as well? The reason for the above question is that even though at the language level copy initialization and assignment are somewhat mixed together by the type being either limited or not, they are in fact distinct concepts and not that much similar. In the tutorial analogy of famous shapes, it might be perfectly reasonable to duplicate an arbitrary Shape'Class (whatever it is), but it will be completely unreasonable to assign Square to some existing Circle. This problem alone would be sufficient for me to make everything limited. Similarly with the interpreter objects, states in FSMs, and so on. Thus, for the purpose of modeling clarity I prefer to distinguish between: - copyability, which means support for copy-initialization *and* assignment - cloneability, which is always deep So - even though my tagged types are typically limited, in some particular cases they can be also cloneable. It does not apply to files, sockets, database connections and similar things that are associated with some resources that exist outside of the physical representation of the object, but it might apply to self-contained data entities like interpreter instructions, document elements, states in FSMs, etc. I hope that the above clarification makes my rule of thumb more understandable and not really conflicting with your examples. -- Maciej Sobczak * http://www.inspirel.com