ISAC: Read and vote on USE subtype issues

From: Chuck Swart <cswart_at_.....>
Date: Fri Mar 04 2005 - 16:10:59 PST
Below is a portion of the minutes related to USE subtype issues
(slightly edited.)  Please review these notes, think about the issues,
then vote on the following so that I can update the IR appropriately.
Please deal with these as soon as you can, since it might take some
time to reflect your opinions.

Additional comments are welcome, of course.

Chuck Swart

A. For example A. when
    USE work.p1.enum2;
is executed which enums should be made visible:

______  All enums from the base type (A,B,C,D)


______  Only enums B and C (adopt locally static subtype rules)


B. In example B the consensus seems to be that when you

     USE work.p2.enum2;

then only the name "enum2" and the overloaded operator "=" in
package p2 become visible. Do you agree with this interpretation?



_____  Agree.


_____  Disagree.


C. In example C if you


    USE work.p1.enum2;

Should the base type be also made visible?

____   Yes, the base type should be made visible.


____   No the base type should not be made visible.


BONUS QUESTION

C2. If you voted yes for question C then if, in the second part of C you

      USE work.p1.int2;


Then should (sub)type int1 be also made visible?

____ Yes, when the subtype is used, the base type or "first named 
subtype" should
     be made visible.


____ No, when the subtype is used, declaring (sub)types are made visible 
only if the
     base types are not anonymous.




TOPIC: IR 2058 Does USE of type name make operators and literals visible?

Some new issues were raised.

A. Visibility of enumeration subtypes

Consider:

    PACKAGE p1 IS
        TYPE enum1 IS (A,B,C,D);
        SUBTYPE enum2 is enum1 RANGE B TO C;
    END PACKAGE p1;

    USE work.p1.enum2;

According to the proposed solution all enum literals would become
visible.  An alternate proposal is to make only the enums identified
by the subtype declaration, B and C, visible.

Subtype declarations use subtype indications which are very
general. For example, the following subtype declaration is legal (in
the context of the above example).

        SUBTYPE enum3 is enum1 range A to general_function(1);

If you were to USE enum2, the analyzer hasn't enough information to
restrict the visibility of enumeration literals from enum1.

So, in general it seems most reasonable to ignore the constraint
of the subtype in determining visibility.

A counterproposal is to restrict visibility of enumeration subtypes if
the subtype indication is sufficiently limited. It seems that a
locally static range would suffice.

B. Subtypes declared in a different package from the base type.

Consider:

    PACKAGE p1 IS
        TYPE enum1 is (A,B,C,D);
    END PACKAGE p1;

    USE work.p1.ALL;
    PACKAGE p2 IS
        SUBTYPE enum2 is enum1 range B to C;
        -- overload the "=" operator from P1;
        FUNCTION "="(left,right:enum2) return BOOLEAN;
    END PACKAGE p2;

    USE work.p2.enum2;
    ENTITY e IS...

What names/operators should be visible in entity e?  The general
consensus is that

    enum2 and the overloaded "=" operator declared in

package p2 should be visible.  This preserves the idea/principle that

    USE p.x makes (potentially) visible a subset of USE p.ALL;

The currently proposed solution will need to be slightly revised to
reflect this.

C. IF a subtype is USEd should the base type become visible?

Consider:

    PACKAGE p1 IS
        TYPE enum1 is (A,B,C,D);
        SUBTYPE enum2 is enum1;
    END PACKAGE p1;

    USE.work.p1.enum2;

When enum2 is USED should enum1 also become visible?

Argument in favor: The fundamental proposal for this IR is to make the
predefined operators visible when the type or subtype is USED. The
parameters to these operators are of the base type.  It is confusing to
have operators visible, but to have the types involved in the operator
not visible.

Argument against: Extra visible names pollute the name space. If you
want the type to be visible then USE the type.  Also, what about

    PACKAGE p1 IS
      TYPE int1 IS RANGE 1 TO 10;
      SUBTYPE int2 IS int1 RANGE 2 TO 5;
    END p1
....
      USE work.p1.int2;

In this case the base type is anonymous, but do you make the declared
"first named subtype" int1 visible? If so, this might lead to a
complicated set of rules determining which subtypes to make visible.
Received on Fri Mar 4 16:11:13 2005

This archive was generated by hypermail 2.1.8 : Fri Mar 04 2005 - 16:11:14 PST