This site contains older material on Eiffel. For the main Eiffel page, see http://www.eiffel.com.

NICE Language Committee: ms-exp-gen

-----------------------------------------------------------
Key:    MS-EXP_GEN
Title:  Expanded types and genericity
From:   Michael Schweitzer (17 Aprils 1994)
-----------------------------------------------------------

Problem 1:

If C is a non-basic class and 'a' and 'b' are declared as

        a : ARRAY [C]
        b : ARRAY [expanded C]

what is then the effect of the instruction

        a := b      -- ?

The reason why this is a problem: if at some other
point we have

        c := a.item (index)

where 'c' is of type 'C', then the item should be cloned,
since 'a.item (index)' is of type 'expanded C'. However,
this cannot be determined by the compiler, since accurate
prediction of types is in general not possible (the assignment
to 'c' could happen in another class).

Problem 2:

If 'a' and 'b' are declared as

        a : ARRAY [ANY]
        b : ARRAY [INTEGER]

what is then the effect of the instruction

        a := b      -- ?

Again, the problem arises as soon as we try to execute

        c := a.item (index)

where 'c' is of type ANY. Here, the item is of type
INTEGER and should therefore be converted to INTEGER_REF
first.
-----------------------------------------------------------
Any suggestions?
-----------------------------------------------------------
Best regards,
    Michael