Hi everyone, So I thought I'd do a little progress update on the pure function research.
So far I'm mostly researching how the node builder works, specifically how inline functions are handled, since that's a situation where a 'call' node is effectively replaced, and I intend to builda similar system to handle pure functions. Designing an emulator to step through the nodes is a little tricker if only in regards to where it should slot into the project. It's a fun challenge, but probably one of the most technical problems I've undertaken to date. The full design is a little awkward because I want to cover every eventuality, which is hard to predict. Fully self-contained functions with only a single output parameter (i.e. the result) are relatively straightforward as I don't have to handle any calls to other pure functions, and the 'call' node can be replaced with a node representing a literal of some kind once it's calculated, but it gets more complicated if other pure functions are called inside it, there are 'out' parameters or there are difficult situations like infinite loops or code paths that simply take too long to complete. There's also testing required to see if the functions still work with partial compilation (i.e. where some PPU files aren't rebuilt). As stated in the Wiki page, my first test case is the Max function. Since it works both as an inline and a pure function, I can easily change the directive to analyse the code flow in the compiler. Gareth aka. Kit _______________________________________________ fpc-devel maillist - firstname.lastname@example.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel