home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.eiffel
- Path: sparky!uunet!mcsun!news.funet.fi!ajk.tele.fi!funic!nokia.fi!newshost!matthew
- From: matthew@ntl02.decnet.nokia.fi (Matthew Faupel)
- Subject: Re: select (Eiffel 3.0)
- In-Reply-To: matthew@ntl02.decnet.nokia.fi's message of Tue, 8 Sep 1992 16:08:26 GMT
- Message-ID: <MATTHEW.92Sep8162544@matthew.ntl02.decnet.nokia.fi>
- Lines: 60
- Sender: usenet@noknic.nokia.fi (USENET at noknic)
- Nntp-Posting-Host: matthew.uk.tele.nokia.fi
- Organization: Nokia Telecommunications, Cambridge, UK
- References: <GEOFF.92Sep8101023@wodehouse.flash.bellcore.com>
- <MATTHEW.92Sep8160738@matthew.ntl02.decnet.nokia.fi>
- Date: Tue, 8 Sep 1992 16:26:32 GMT
-
- GC: Geoffrey Clemm in article <GEOFF.92Sep8101023@wodehouse.flash.bellcore.com>
- MF: Me in article <MATTHEW.92Sep7142939@matthew.ntl02.decnet.nokia.fi>
-
- MF: class A
- MF: feature x: INTEGER is
- MF: Result := 1 end end
- MF: class B inherit A rename x as Bx, redefine Bx
- MF: feature Bx: INTEGER is
- MF: Result := 2 end end
- MF: class C inherit A rename x as Cx, redefine Cx
- MF: feature Cx: INTEGER is
- MF: Result := 3 end end
- MF: class D inherit B, C
- MF: select Bx end
- MF: ...
- MF: Now come the tricky ones:
-
- MF: aC := aD;
- MF: aC.Cx; -- returns 2 or 3?
- MF: anA := aC;
- MF: anA.x; -- returns 2 or 3?
-
- MF: Can anyone help?
-
- GC: Cx has never been redefined or renamed, so it will always return 3.
-
- GC: If the dynamic type of anA is aC, then anA.x must be the Cx that redefines x.
- GC: The select statement in D (or for that matter, the very existence of D) is
- GC: irrelevant to this decision.
-
- GC: I'm not sure why these are tricky. How could the answers be anything else ?
-
- Ah... I seem to have phrased the question rather badly, because this is the
- second reply I've had which misinterpreted it. What I meant was:
-
- !!aD; aC := aD; anA := aC; anA.x; -- a
- anA := aD; anA.x; -- b
-
- Here we have two invocations of the same feature name on the same dynamic
- object via the same static reference, do they produce different results
- (i.e. does a return 3 but b, 2) or the same (both returning 2 because
- feature Bx was selected as the dominant implementation of x when referring
- to an object of type D via a reference of type A)?
-
- In other words, does select always operate or only when the assignment path
- doesn't make it clear which version of the feature should be used?
-
- I've now had an answer from someone in ISE, and the answer is that they both
- return 2; the assignment path makes no difference. Next question, is this
- really the desired behaviour? Answers on a postcard please :-)
-
- Cheers,
-
-
- Matthew
- --
- ---* Amnesiac the Wizard *------------------* matthew@uk.tele.nokia.fi *---
- Opinions expressed here are not those of my company. | NB. ntl02 is EN
- They're not even my own; I plagiarised the lot of them! | TEE EL ZERO TWO
- ---* matthew@ntl02.decnet.nokia.fi *------------------* Matthew Faupel *---
-