ABSTRACT forward procedures

Programming language questions

ABSTRACT forward procedures

Postby Robert » Thu Oct 06, 2016 8:33 am

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?
User avatar
Robert
 
Posts: 119
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: ABSTRACT forward procedures

Postby Josef Templ » Thu Oct 06, 2016 12:27 pm

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

- Josef
Josef Templ
 
Posts: 218
Joined: Tue Sep 17, 2013 6:50 am


Return to Component Pascal

Who is online

Users browsing this forum: No registered users and 0 guests

cron