P11e2: type labels (revised)
Ed Barkmeyer
edbark at nist.gov
Wed May 8 11:43:11 EDT 2002
All,
I should have thought a bit longer before my previous message.
I said:
> I think there are situations in which it is useful to say that two
> attributes, or an attribute and the base type of an aggregate, have the
> same actual type, even though they are both declared GENERIC_OBJECT,
> for example. On the other hand, it is also possible to declare this
> in a WHERE clause in the ABSTRACT ENTITY declaration.
I think this last is not true. Consider:
ENTITY snark ABSTRACT;
a1: GENERIC_OBJECT;
a2: GENERIC_OBJECT;
WHERE
same_type: TYPEOF(a1) = TYPEOF(a2); ???
END_ENTITY;
doesn't suffice. It doesn't require that the types are *declared* to
be the same; it just says the instances have to behave as if they were.
And it doesn't work if the instance of a1 or a2 is an instance of a
subtype of the declared type. The subtype work-around:
same_type: TYPEOF(a1) * TYPEOF(a2) = TYPEOF(a1);
says that a2 must be an instance of the type of a1, but that also
assumes that a1 instantiates exactly the declared type, and not a
subtype thereof.
And for
ENTITY snark ABSTRACT;
a1: AGGREGATE OF GENERIC_OBJECT;
a2: AGGREGATE OF GENERIC_OBJECT;
WHERE
same_type: TYPEOF(a1) = TYPEOF(a2); ???
END_ENTITY;
doesn't even come close. TYPEOF just returns the keyword for the
aggregate, e.g. 'SET'. And now the problem above becomes more
obvious: which element of a1, if any, has exactly the type to
which all the elements of a2 must belong?
So the effect of type-labels cannot, I think, be achieved by a
WHERE clause. We should allow type-labels.
This means we need to revise 10.3.15 and add wording to 9.2.3.4
to explain the implications of the type-label for attribute
redeclarations.
-Ed
--
Edward J. Barkmeyer Email: edbark at nist.gov
National Institute of Standards & Technology
Manufacturing Systems Integration Division
100 Bureau Drive, Mail Stop 8260 Tel: +1 301-975-3528
Gaithersburg, MD 20899-8260 FAX: +1 301-975-4482
"The opinions expressed above do not reflect consensus of NIST,
and have not been reviewed by any Government authority."
More information about the wg11
mailing list