RE: [sv-ec] casting between class handles

From: Shalom Bresticker <shalom.bresticker@outlook.com>
Date: Mon Dec 14 2015 - 01:22:16 PST
Where is that explained? The spirit of the text sounds very different from
that, as the text says, "the type of the source expression is a superclass
of the destination type".

 

From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of Steven
Sharp
Sent: Monday, December 14, 2015 12:42 AM
To: Shalom Bresticker; sv-ec@eda.org
Subject: RE: [sv-ec] casting between class handles

 

The rules are the same as the ones you already quoted (assign to same type
or superclass type, or appropriate interface class type), but applied to the
type of the actual object determined at runtime instead of the type of the
handle variable determined at compile time.

 

 

From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of Shalom
Bresticker
Sent: Sunday, December 13, 2015 6:39 AM
To: sv-ec@eda.org
Subject: [sv-ec] casting between class handles

 

8.16 (Casting) says,

 

"It is always legal to assign an expression of subclass type to a variable
of a class type higher in the inheritance tree (a superclass or ancestor of
the expression type). 

It shall be illegal to directly assign avariable of a superclass type to a
variable of one of its subclass types. 

However, $cast may be used to assign a superclass handle to a variable of a
subclass type provided the superclass handle refers to an object that is
assignment compatible with the subclass variable."

 

Similarly, it says below,

 

"When $cast is applied to class handles, it succeeds in only three cases:

.

2) The type of the source expression is cast compatible with the destination
type, that is, either:

- the type of the source expression is a superclass of the destination type,
or

.

and the source is an object that is assignment compatible with the
destination type."

 

Question: where is the definition of assignment compatibility between class
objects?

 

Thanks,

Shalom 
Received on Mon Dec 14 01:22:20 2015

This archive was generated by hypermail 2.1.8 : Mon Dec 14 2015 - 01:22:32 PST