Re: [fpc-pascal] Writeable typed constants - what's the point?

2009-06-19 Thread Martin Friebe
Jürgen Hestermann wrote: Paul Nicholls schrieb: I also find writable constants hand for things like this where I can define the 'variable' + values too so I don't have to set the values at run time: But can't you do the same with a variable declaration? If you want to change the value at

Re: [fpc-pascal] Writeable typed constants - what's the point?

2009-06-19 Thread Graeme Geldenhuys
Martin Friebe wrote: The const version act like a global variable. It is set to 1 once at some time before the 1st call to Foo. It will not be initialized again. If Foo chages it, it will keep the changed value, even between calls to Then this is a language issue. 'const' is clearly not the

Re: [fpc-pascal] Writeable typed constants - what's the point?

2009-06-19 Thread Jürgen Hestermann
The var version, acts as if your first statement in the procedure was a:= 1;. It initializes the variable each time you enter the function. If you enter the function recursively, then each level, has it's own a, not touching the value of the callers a I also used Borlands const-hack a lot.

Re: [fpc-pascal] Writeable typed constants - what's the point?

2009-06-19 Thread David W Noon
On Fri, 2009-06-19 at 18:35 +0200, Jürgen Hestermann wrote: The var version, acts as if your first statement in the procedure was a:= 1;. It initializes the variable each time you enter the function. If you enter the function recursively, then each level, has it's own a, not touching