🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.eiffel
Article #1279

Re: Possible Inheritance Anomaly

#1279
From: Andrew K. Wright
Date: Tue, 10 Jan 1989 13:30
27 lines
1536 bytes
In article <6416@bunny.UUCP> dcr0@bunny.UUCP (David Robbins) writes:
>I've come across an apparent anomaly in the Eiffel inheritance mechanism.

>   class B export f1, f2, f3
>   inherit A rename f1 as f3 redefine f2
>   feature
>      f1 is do putstring("I am B.f1"); new_line end;
>      f2 is do putstring("I am B.f2"); new_line end
>   end

This seems to me to be a bug in the compiler.  However, whether your
example is also incorrect is not made entirely clear in the book.
The problem is the meaning of "rename": if you are renaming
f1 as f3, does this mean that you can now define your own f1
without a redefine clause?

In the current compiler, it appears that you cannot, but the compiler
misses generating an error message for your example.
Changing the inherit clause of class B to
>   inherit A rename f1 as f3 redefine f2, f1
fixes your example.

However, I would vote that the compiler be changed to accept your
example as valid.  Thus rename implies redefine (in a sense).

Andrew K. Wright      akwright@watmath.waterloo.edu
CS Dept., University of Waterloo, Ont., Canada.
Technical Details
Message-ID: <10691@watdragon.waterloo.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!watdragon!akwright
References: <6416@bunny.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!watdragon!akwright
From: akwright@watdragon.waterloo.edu (Andrew K. Wright)
Newsgroups: comp.lang.eiffel
Subject: Re: Possible Inheritance Anomaly
Keywords: inheritance
Message-ID: <10691@watdragon.waterloo.edu>
Date: 10 Jan 89 13:30:41 GMT
References: <6416@bunny.UUCP>
Reply-To: akwright@watdragon.waterloo.edu (Andrew K. Wright)
Organization: U. of Waterloo, Ontario
Lines: 27