Page 1 of 1

ABSTRACT forward procedures

Posted: Thu Oct 06, 2016 8:33 am
by Robert
I don't understand why the following code is illegal.

Code: Select all

MODULE  PrivTest;
TYPE
  Thing*    =  POINTER  TO  ABSTRACT  RECORD  END;
  StdThing  =  POINTER  TO  RECORD (Thing)  END;

PROCEDURE^ (mf : Thing) React* (n : INTEGER), NEW, ABSTRACT;

(*  Code that calls Thing.React  *)

PROCEDURE (mf : Thing) React* (n : INTEGER), NEW, ABSTRACT;
PROCEDURE (mf : StdThing) React* (n : INTEGER);
  BEGIN    (*  do stuff  *)  END  React;
END  PrivTest.
If, in the procedure declarations, I replace ABSTRACT by EMPTY it is also illegal. If I use EXTENSIBLE (and add an empty procedure body to the middle procedure) it is ok.
Is this behaviour described in the Language Reference?

Re: ABSTRACT forward procedures

Posted: Thu Oct 06, 2016 12:27 pm
by Josef Templ
I guess it is because an abstract (or empty) method never "needs" a forward declaration.

- Josef