ABSTRACT forward procedures

Programming language questions
Post Reply
User avatar
Robert
Posts: 177
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

ABSTRACT forward procedures

Post 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?
Josef Templ
Posts: 262
Joined: Tue Sep 17, 2013 6:50 am

Re: ABSTRACT forward procedures

Post by Josef Templ »

I guess it is because an abstract (or empty) method never "needs" a forward declaration.

- Josef
Post Reply