Re: type and subtype
- From: "Dmitry A. Kazakov" <mailbox@xxxxxxxxxxxxxxxxx>
- Date: Mon, 25 Jul 2005 10:23:34 +0200
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
.
- Follow-Ups:
- Re: type and subtype
- From: Jeffrey Carter
- Re: type and subtype
- References:
- type and subtype
- From: Douglas Chong
- Re: type and subtype
- From: Ludovic Brenta
- Re: type and subtype
- From: Jeffrey Carter
- type and subtype
- Prev by Date: Re: Ada Jobs
- Next by Date: Re: Isn't this in favour of Ada??
- Previous by thread: Re: type and subtype
- Next by thread: Re: type and subtype
- Index(es):
Relevant Pages
|