[fpc-pascal] method order

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Apr 30 19:17:51 CEST 2010


On Fri, 30 Apr 2010 18:34:43 +0200
spir ☣ <denis.spir at gmail.com> wrote:

> (Note: I use "method" for "either procedure or function"; if there is a proper term, please tell me --I don't know any.)

Normally:

method = function/procedure of a class with an instance 'Self'

class method = method where Self is the class type, not an instance


> A short question:
> Why must a called method be defined before the caller, since it will be called only at runtime?
> Also: what is the trick then (on the implementation side), to allow recursion?

Maybe you don't know 'forward'?

procedure DoSomething; forward;

procedure Doing;
begin
  if ... then DoSomething;
end;

procedure DoSomething;
begin
  if ... then Doing;
end;


Mattias



More information about the fpc-pascal mailing list