[fpc-devel] Pure function development

J. Gareth Moreton gareth at moreton-family.com
Fri May 1 11:41:14 CEST 2020


I'm still learning these things - bear with me!  I'll get one set up 
when I have something preliminary working.

At the moment I haven't been able to unite the constant propagation code 
with my pure functions because they work in fundamentally different ways 
- for inline functions constant propagation makes a copy of a node tree 
then transmorphs them as it propagates the constants, while my code just 
takes the node tree and steps through it without modifying it.  I guess 
there's merits for both approaches, but because of pure functions' 
ability to be recursive, I'm worried about malicious functions causing a 
massive ballooning of nodes and memory issues before the compiler 
detects an infinite loop (or one that is simply too long) before 
destroying all of the nodes again, throwing a warning and keeping the 
original call node.  Also, there are places where nodes can't actually 
be used, like in the definition of constants, and they simply have to 
have their results calculated.

We'll see though - this could prove to be insightful.

Gareth aka. Kit


-- 
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



More information about the fpc-devel mailing list