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

NICE Language Committee: ms-pointer

-----------------------------------------------------------
Key   : MS-POINTER
Title : Type POINTER - conformance.
-----------------------------------------------------------
Proposal (Michael Schweitzer, late March 1994)

Discussion:

As far as I can see, the conformance rules for type POINTER
are not clearly defined. I always thought that POINTER con-
forms only to itself and nothing but POINTER conforms to it.

But recently (comp.lang.eiffel - ISE bug report) Bertrand
said that POINTER should conform to ANY. If this is the
case then an assignment of the form

            a := p  -- `a' of type ANY, `p' of type POINTER

requires a type promotion, similar to the case

            a := i  -- `a' of type ANY, `i' of type INTEGER.

In the latter example `i' is first promoted to INTEGER_REF.

Proposals (two alternatives):

(1)

Type POINTER conforms only to itself and no type other than
POINTER conforms to it.

(2)

We introduce a class POINTER_REF. It has only one feature
`item' of type POINTER. POINTER is an expanded class which
inherits from POINTER_REF. POINTER conforms directly to
POINTER_REF (and therefore indirectly to ANY). In a reattachment
of the form

        r := p

where `r' is a reference type and `p' a POINTER, `p' is first
converted into a POINTER_REF and a reference to that object
is attached to r.

Comment:

I don't have a clear preference for one of the two proposals.
The only thing that matters for me is that there is a clear
and definite rule. Neither of the two proposals requires significant
changes in our new implementation. Currently we've implemented
version (2).
-----------------------------------------------------------
Agreement (Steve Tynor)


This is what TowerEiffel does. I think that it's the correct choice:
without a POINTER_REF-like conversion, POINTER's can't be reverse
assigned, and thus can't be read from a generalized persistent store.

Note that the Tower POINTER_REF has more than just `item':

   class POINTER_REF

   ancestors
      POINTER_REF

   creation features
      make

   feature specification
      set_item,
      make (p: POINTER)
   	 -- Make a POINTER_REF from `p'.

      item : POINTER
   	 -- The value of this reference

   end

The `set_item' and `make' features are for consistency with other *_REF
classes.
-----------------------------------------------------------

Agreement (Bertrand Meyer)

This is a bit of overkill but I agree it is consistent with
the other basic types so I support the proposal, alternative (2).

I do not support Steve's `make', however, since it
does not exist in other classes.