comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: type and subtype
Date: Mon, 25 Jul 2005 10:23:34 +0200
Date: 2005-07-25T10:23:32+02:00	[thread overview]
Message-ID: <b4k0ygaqf0u4$.102vj4zdpubdy.dlg@40tude.net> (raw)
In-Reply-To: _vPEe.3516$Uk3.77@newsread1.news.pas.earthlink.net

On Sun, 24 Jul 2005 16:40:26 GMT, Jeffrey Carter wrote:

> Ludovic Brenta wrote:
>> 
>> Two subtypes of the same type are compatible with one another.  One
>> can convert between them using an implicit type conversion (i.e. no
>> special syntax required).
> 
> There is no type conversion between subtypes of the same type, since 
> they are the same type. There are checks that the value of the source 
> matches the constraints of the destination.

This sounds much like hairsplitting. However it is an important issue for
the future.

I think that Ludovic's view is more consistent: checks are just a part of
the conversion which otherwise is an identity function, because *presently*
the representation is required to be same. But representation is an
implementation detail and thus cannot count. Moreover it is very desirable
to allow subtypes having different representations. For example: statically
constrained subtypes with removed constant discriminants from their values;
T'Class constrained to some specific type S could remove the type tag from
its objects, etc. Such subtypes would require more-than-checks conversions.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2005-07-25  8:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-24 14:24 type and subtype Douglas Chong
2005-07-24 14:39 ` Dmitry A. Kazakov
2005-07-25 17:07   ` Martin Krischik
2005-07-24 16:20 ` Ludovic Brenta
2005-07-24 16:40   ` Jeffrey Carter
2005-07-25  8:23     ` Dmitry A. Kazakov [this message]
2005-07-25 15:41       ` Jeffrey Carter
2005-07-25 21:59         ` Ludovic Brenta
2005-07-26  8:21         ` Dmitry A. Kazakov
2005-07-25 17:02 ` Martin Krischik
replies disabled

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