[fpc-devel] Little question about the "First Pass"
J. Gareth Moreton
gareth at moreton-family.com
Wed Aug 8 22:44:55 CEST 2018
Hi everyone,
So I'm making progress with my pure function implementation, or something
passing as an early alpha prototype. I do have a question though... when
the "firstpass" routines are called, have all the procedures been compiled
into nodes yet? I'm still trying to work out the best time to evaluate
function purity, partly due to constructs such as this:
interface
function PureFunc1(Input: Integer): Boolean;
function PureFunc2(Input: Integer): Boolean;
implementation
function PureFunc1(Input: Integer): Boolean; pure;
begin
Result := PureFunc2(Input * Input); { "pure" directive for PureFunc2
hasn't been seen yet }
end;
function PureFunc2(Input: Integer): Boolean; pure;
begin { Do something complicated but deterministic! }
end;
****
I could probably find the answer after some long research, but I'm trying
to avoid wasting time unnecessarily. I would guess that the evaluation
should occur at a similar time to when inline functions are expanded, where
they are fully-defined and known to be inlinable.
Gareth aka. Kit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180808/de43e696/attachment.html>
More information about the fpc-devel
mailing list