comp.lang.ada
 help / color / mirror / Atom feed
From: "Vinzent Hoefler" <nntp-2010-10@t-domaingrabbing.de>
Subject: Re: Discriminants of tagged types
Date: Sat, 30 Oct 2010 23:21:39 +0200
Date: 2010-10-30T23:21:39+02:00	[thread overview]
Message-ID: <op.vleqydfe0k3wt7@jellix.jlfencey.com> (raw)
In-Reply-To: 3c44f6d7-7ff0-4362-8902-fbcfe0eee788@a37g2000yqi.googlegroups.com

On Sat, 30 Oct 2010 23:05:09 +0200, Maciej Sobczak <see.my.homepage@gmail.com> wrote:

> On 29 Paź, 20:59, "Vinzent Hoefler" <nntp-2010...@t-domaingrabbing.de>
> wrote:
>
>> > Just like a file descriptor. Yet, there is no reason for these things
>> > 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.



  reply	other threads:[~2010-10-30 21:21 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27 12:16 Discriminants of tagged types Maciej Sobczak
2010-10-27 12:34 ` Ludovic Brenta
2010-10-27 13:19   ` Dmitry A. Kazakov
2010-10-27 13:52     ` Robert A Duff
2010-10-27 14:12       ` Dmitry A. Kazakov
2010-10-27 13:44 ` Robert A Duff
2010-10-27 15:06   ` Adam Beneschan
2010-10-27 15:58     ` Yannick Duchêne (Hibou57)
2010-10-27 16:35       ` Vinzent Hoefler
2010-10-27 17:58       ` J-P. Rosen
2010-10-27 20:18         ` Yannick Duchêne (Hibou57)
2010-10-27 20:26       ` Adam Beneschan
2010-10-27 22:07         ` Yannick Duchêne (Hibou57)
2010-10-27 22:42           ` Adam Beneschan
2010-10-27 15:13   ` Maciej Sobczak
2010-10-27 16:02     ` Yannick Duchêne (Hibou57)
2010-10-27 21:13       ` Maciej Sobczak
2010-10-27 21:23         ` Ludovic Brenta
2010-10-28  8:38           ` Maciej Sobczak
2010-10-27 21:25         ` Vinzent Hoefler
2010-10-28  7:53         ` Dmitry A. Kazakov
2010-10-28  8:50           ` Maciej Sobczak
2010-10-28 10:28             ` Dmitry A. Kazakov
2010-10-28 17:48             ` Yannick Duchêne (Hibou57)
2010-10-29 18:59             ` Vinzent Hoefler
2010-10-30 21:05               ` Maciej Sobczak
2010-10-30 21:21                 ` Vinzent Hoefler [this message]
2010-10-30 22:01                   ` Yannick Duchêne (Hibou57)
2010-10-31 16:20                   ` Maciej Sobczak
2010-10-31 17:04                     ` Yannick Duchêne (Hibou57)
2010-10-31 18:36                     ` Shark8
2010-10-31 21:06                       ` Maciej Sobczak
2010-11-01  0:44                         ` Shark8
2010-11-01  9:41                           ` Maciej Sobczak
2010-10-27 16:06     ` Robert A Duff
2010-10-27 16:34       ` Yannick Duchêne (Hibou57)
2010-10-27 21:05       ` Maciej Sobczak
2010-10-28  0:35         ` Robert A Duff
2010-10-28  8:55           ` Maciej Sobczak
2010-10-27 21:28       ` Simon Wright
2010-10-27 13:54 ` J-P. Rosen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox