Re: [fpc-devel] Pure function development discussion

2018-08-12 Thread J. Gareth Moreton
Limiting pure functions to the definitions of constants severely limits their usefulness, and programmers may just ignore them completely and calculate their results by hand where needed (e.g. replacing ln(2) with 0.69 etc.).  They're designed to replace entire function calls with pre-calculated r

Re: [fpc-devel] Pure function development discussion

2018-08-12 Thread Dmitry Boyarintsev
On Sat, Aug 11, 2018 at 8:50 PM J. Gareth Moreton wrote: > How and when is the constant defined? Should such constructs be disallowed > and constants only allowed to be declared in other units that use the unit > that contains the pure functions in its interface section? What would be > the ideal

Re: [fpc-devel] Pure function development discussion

2018-08-11 Thread J. Gareth Moreton
I'm still figuring bits and pieces out, but I've managed to change the checks so the error that I listed in the last e-mail only appears for forward-declared functions, not interface + implementation, since I believe everything gets fully defined by the time the first pass comes along.  I'm still

[fpc-devel] Pure function development discussion

2018-08-11 Thread J. Gareth Moreton
Hi everyone.  The development of pure function support is going well, along with catching error cases.  Thanks to some discussion from Sven, the compiler will now detect if you reference a function before defining it as "pure", so cases where it's defined as "forward" are trapped as errors so as t