Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-04

method order

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

spir ☣

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

Hello,

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?

Denis
________________________________

vit esse estrany ☣

spir.wikidot.com

Reply by email

Mattias Gaertner
to spir ☣
(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

Reply by email