Re: [fpc-devel] Pure function Wiki page

2018-07-09 Thread J. Gareth Moreton
On Mon 09/07/18 22:39 , "Bart" bartjun...@gmail.com sent: > On Mon, Jul 9, 2018 at 6:59 PM, J. Gareth Moreton > > e...@moreton-family.com> wrote: > > > > out, not least because the answer will cause an > overflow (e.g. the result of > > A(4,2) has almost 20,000 decimal digits and, > naïvely,

Re: [fpc-devel] Pure function Wiki page

2018-07-09 Thread J. Gareth Moreton
On Mon 09/07/18 20:53 , wkitt...@windstream.net sent: > > > > > sorry for this off-topic post but are you aware that your messages are not > > threading into the topic under discussion? every one of your posts looks > like a > separate thread and there's nothing to link it to the message

Re: [fpc-devel] Pure function Wiki page

2018-07-09 Thread Bart
On Mon, Jul 9, 2018 at 6:59 PM, J. Gareth Moreton wrote: > out, not least because the answer will cause an overflow (e.g. the result of > A(4,2) has almost 20,000 decimal digits and, naïvely, takes longer than the > age > of the Universe to compute). Ackerman(4,2) = (2^65536) - 3 (it's

Re: [fpc-devel] Pure function Wiki page

2018-07-09 Thread wkitty42
sorry for this off-topic post but are you aware that your messages are not threading into the topic under discussion? every one of your posts looks like a separate thread and there's nothing to link it to the message you are actually responding to... looking at them, there's no references

Re: [fpc-devel] Pure function Wiki page

2018-07-09 Thread Florian Klaempfl
Am 09.07.2018 um 18:24 schrieb Max Nazhalov via fpc-devel: Just one question: doesn't all this new stuff introduce another kind of mess during cross-compiling? E.g. some complex nested const.expr. "sin(cos(0.12345))" evaluated by the compiler on x64 (double precision) is not the same as if it

Re: [fpc-devel] Pure function Wiki page

2018-07-09 Thread J. Gareth Moreton
The intention is to perform the analysis of pure functions at the pre-compilation stage where all the Pascal code is transmuted into nodes, which are platform-independent and also have the advantage of not requiring total rebuilding of a project, since it is these nodes that are stored in PPU

Re: [fpc-devel] Pure function Wiki page

2018-07-09 Thread Thorsten Engler
> -Original Message- > From: fpc-devel On Behalf Of > Max Nazhalov via fpc-devel > Sent: Tuesday, 10 July 2018 02:25 > > Just one question: doesn't all this new stuff introduce another kind > of mess during cross-compiling? > > E.g. some complex nested const.expr. "sin(cos(0.12345))"

Re: [fpc-devel] Pure function Wiki page

2018-07-09 Thread J. Gareth Moreton
Admittedly I have slightly selfish reasons for my proposed improvements. I like to play around with mathematical programming where loops can run for several days or weeks, so even the slimmest of savings adds up to a lot of saved time... and I love Object Pascal! Granted I can use assembly

Re: [fpc-devel] Pure function Wiki page

2018-07-09 Thread Max Nazhalov via fpc-devel
Just one question: doesn't all this new stuff introduce another kind of mess during cross-compiling? E.g. some complex nested const.expr. "sin(cos(0.12345))" evaluated by the compiler on x64 (double precision) is not the same as if it would be evaluated by the compiled program itself running on

Re: [fpc-devel] Pure function Wiki page

2018-07-09 Thread Ryan Joseph
> On Jul 9, 2018, at 3:25 AM, Sven Barth via fpc-devel > wrote: > > It would allow you to declare constants that use those functions with the > compiler evaluating them at compile time. That’s a double win then. Very good idea this is. Regards, Ryan Joseph

Re: [fpc-devel] Pure function Wiki page

2018-07-09 Thread R0b0t1
On Sun, Jul 8, 2018 at 4:43 PM, Thorsten Engler wrote: >> -Original Message- >> From: fpc-devel On Behalf Of >> R0b0t1 >> Sent: Monday, 9 July 2018 07:22 >> >> There were some other comments touching on reasons for or against a >> keyword, and I apologize for not speaking to them

Re: [fpc-devel] Pure function Wiki page

2018-07-09 Thread J. Gareth Moreton
I meant to say tan(Pi / 4) in that example. Sorry. Trying to assign tan(Pi / 2) to something will probably cause an error, or at the very least be an interesting test case, because the result is undefined. Gareth aka. Kit On Mon 09/07/18 12:00 , "J. Gareth Moreton"

Re: [fpc-devel] Pure function Wiki page

2018-07-09 Thread J. Gareth Moreton
Besides being able to assign the function result to constants, the main benefit is that, for constant inputs, the result is deterministic and so the compiler can calculate this beforehand and replace a function call with an assignment. For example, if tan was a regular function, x := tan(Pi

Re: [fpc-devel] Pure function Wiki page

2018-07-09 Thread Sven Barth via fpc-devel
Ryan Joseph schrieb am Mo., 9. Juli 2018, 08:45: > > > > On Jul 8, 2018, at 8:50 AM, J. Gareth Moreton > wrote: > > > > With some blessing from Florian on the concept, I've set up a Wiki page > discussing the design proposals for the support of pure functions, as well > as some explanation on

[fpc-devel] Default record fields

2018-07-09 Thread Ryan Joseph
I posted this on the main list before but I want to repost here. Last month I decided finally after years to try working on the compiler and in short time I was able to add parameters to macros (like in C). The FPC list appeared to universally despise this idea so I guess I’ll just sit on it

Re: [fpc-devel] Pure function Wiki page

2018-07-09 Thread Ryan Joseph
> On Jul 8, 2018, at 10:55 AM, Marco van de Voort wrote: > > It doesn't explain why you chose for a modifier rather than preprocessor > switch. Performance aside I think it’s useful to mark a function as “pure” so you can guarantee it’s not messing with global state. I’m sure I could have

Re: [fpc-devel] Pure function Wiki page

2018-07-09 Thread Ryan Joseph
> On Jul 8, 2018, at 8:50 AM, J. Gareth Moreton > wrote: > > With some blessing from Florian on the concept, I've set up a Wiki page > discussing the design proposals for the support of pure functions, as well as > some explanation on what they actually are. > What are the performance