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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,4ce5890331a5b529 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!news3.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Vinzent Hoefler" Newsgroups: comp.lang.ada Subject: Re: Discriminants of tagged types Date: Sat, 30 Oct 2010 23:21:39 +0200 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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Trace: individual.net sOVpxqgJbXmaz6aXnwsUrwzinfsjR+htMslJBT743toZWIGO2r Cancel-Lock: sha1:bgbUMph+D3Z6UAKQ10w6/DRPwXc= User-Agent: Opera Mail/10.62 (Win32) Xref: g2news1.google.com comp.lang.ada:14992 Date: 2010-10-30T23:21:39+02:00 List-Id: On Sat, 30 Oct 2010 23:05:09 +0200, Maciej Sobczak wrote: > On 29 Pa=C5=BA, 20:59, "Vinzent Hoefler" > wrote: > >> > Just like a file descriptor. Yet, there is no reason for these thin= gs >> > to be polymorphic. >> >> But they already are. >> >> Sometimes they are files, sometimes devices, sometimes sockets, ... > > No. File descriptors are just indices into some array of objects > managed by the operating system. Maybe they are, maybe they aren't. How are you supposed to know that? > Just plain integers, like here: > > type Descriptor is Integer range 0 .. SOME_MAX; -- this is what you > see No, what I see is: |type Descriptor is private; Making any assumptions about the layout of the type is just guesswork. (Actually, in that particular implementation, I must admit, I made them limited precisely to disallow copying, but the reasons for that have nothing to do with polymorphism, but rather with access rights, meaning I provide different types with different set of operations for clients and servers. And I don't want a client to share it's access rights with another one.) > The actual objects are hidden from you and guess what? They have > polymorphic behaviour (sometimes they behave like files, sometimes > like devices and sometimes like sockets), but they are not themselves > copyable. Given an opaque type, how can you tell the difference? The set of visible operations is the same. Anything else is an implementation detail that does not concern the user of the type. IMO polymorphism and copy semantics are distinct concepts. Vinzent. -- = There is no signature.