Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!bloom-beacon!clyde!concour!marcap From: marcap@concour.CS.Concordia.CA (Marc Pawlowsky) Newsgroups: comp.lang.eiffel Subject: redefining constant features Summary: Error on Pass 2 Message-ID: <976@clyde.Concordia.CA> Date: 12 Jul 89 16:38:04 GMT Sender: news@Clyde.Concordia.CA Reply-To: marcap@concour.CS.Concordia.CA (Marc Pawlowsky) Organization: Concordia University, Montreal Quebec Lines: 42 Why is it not legal to redfine a constant feature?? My problem: Class image export nb_directions .... feature nb_directions:INTEGER is 4; Class hex_image export nb_directions ... inherit image redefine nb_directions .... feature nb_directions:INTEGER is 6; is an error on Pass 2 Constant feature may not be redefined: nb_directions yet if I change the code so that in image nb_directions:INTEGER is do Result := 4 end; and in hex_image nb_directions:INTEGER is do Result := 6 end; the program compiles. ************************************************************************** Why I believe this is wrong. ************************************************************************* 1. Using information sharing it is no buisness of the ancestors how a value is calculated. So there is a consistency problem. 2. There is no reason why the redefinition should not be allowed. At all times the constant value can have only one possibility. Is the trouble that a procedure in the parents class might not work if a child calls it with a constant redefined. If so that is a case where the child whould redefine the routine.