[comp.lang.eiffel] Allow attributes to be redefined as functions

martin@wsl.ie (Martin Burke on wsl) (05/01/91)

As we all know, one cannot redefine an attribute as an argumentless function.
This spoils somewhat the symmetry between the two, and makes (as John Potter
noted in his TOOLS tutorial) making something an attribute a bit committing.

The argument given in OOSC (p266), and repeated in 'Eiffel: The Language'
(V2.2 p44), is that the redefinition would invalidate any assignments.  In
the tutorial there also seemed to be hints of implementation reasons (once a
data structure is chosen in the inheritance tree?).

My point is that can we not sort of reuse the static typing of covariance
argument (cf Bertrand Meyer's 'Static Typing in Eiffel') and say that as long
as there are no assignments in the new (flat) class, redefinition is allowed?

(I know some people don't like the covariance argument - I think it's
brilliant - but even if you disagree you're going to be stuck with it in V3!
And anyway, the argument I'm suggesting is much more limited and merely of
same flavour.)

I'd be interested in hearing of the conceptual or implementation problems
with this suggestion.  If possible, I think it would be a nice (if minor)
enhancement for V3(.2?!).

-- 
-- Martin at Workhorse Systems Limited dot Ireland