Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ucsd!ucsbcsl!eiffel!bertrand From: bertrand@eiffel.UUCP (Bertrand Meyer) Newsgroups: comp.lang.eiffel Subject: Re: What is this error? Summary: Procedure should be a function; this problem does not occur in the currently released version. Message-ID: <119@eiffel.UUCP> Date: 13 Mar 89 03:56:34 GMT References: <53250@yale-celray.yale.UUCP> Organization: Interactive Software Engineering, Santa Barbara CA Lines: 43 From article <53250@yale-celray.yale.UUCP>, by jellinghaus-robert@CS.Yale.EDU (Rob Jellinghaus): > I don't expect to get a reply to this in time to be of any help to me, > but I'll ask anyway. I agree. One should not expect too much; then surprises can only be pleasant. > [Reproduction of ``internal error'' message] > > What could I be doing wrong? [...] > The error occurs in a very simple routine: > > index(x: T) is [...] > do > Result := x.hash mod size <--- [Error is detected here] > > And this is only the first class I've ever tried to build with Eiffel. > Needless to say, I am very disappointed. I hope you try a few others. What you are doing wrong is to use ``Result'' in a routine declared as a procedure. A routine that has a result should be declared as a function: index (x: T): INTEGER Then everything will work fine. The improper error message was due to lack of detection in pass 2; then pass 4 would find something wrong but didn't know what happened, hence the ``internal error'' message. I am using the past tense because the problem was uncovered and corrected some time ago; the ``internal error'' message doesn't show up any more. Instead, a clear error message is printed during pass 2. Of course, this is no consolation to someone (such as Mr. Jellinghaus) whose system was shipped before this correction was made. The correction is obviously included in the forthcoming 2.2 release. Sorry for the inconvenience. -- Bertrand Meyer