<p>Am 21.07.2017 10:44 schrieb "Santiago A." <<a href="mailto:svaa@ciberpiula.net">svaa@ciberpiula.net</a>>:<br>
><br>
> El 20/07/2017 a las 15:50, Sven Barth via fpc-pascal escribió:<br>
>><br>
>> Am 20.07.2017 13:01 schrieb "Bo Berglund" <<a href="mailto:bo.berglund@gmail.com">bo.berglund@gmail.com</a>>:<br>
>> ><br>
>> > On Thu, 20 Jul 2017 11:11:50 +0200, Maciej Izak<br>
>> > <<a href="mailto:hnb.code@gmail.com">hnb.code@gmail.com</a>> wrote:<br>
>> ><br>
>> > >2017-07-20 11:03 GMT+02:00 Bo Berglund <<a href="mailto:bo.berglund@gmail.com">bo.berglund@gmail.com</a>>:<br>
>> > ><br>
>> > >> So since I don't really want to use a global, is it possible to<br>
>> > >> declare a local variable static in the sense that it retains its<br>
>> > >> values across calls to the procedure?<br>
>> > >> If so how is it done?<br>
>> > >><br>
>> > ><br>
>> > >procedure foo;<br>
>> > >{$PUSH}<br>
>> > >const{$J+}<br>
>> > >  s : string ='';<br>
>> > >{$POP}<br>
>> ><br>
>> > Thanks,<br>
>> > but it looks a bit involved, probably better to use an object field<br>
>> > variable instead only accessible from the internal methods.<br>
>><br>
>> If you don't want to use $push/$pop then you can also simply enable $J+ for the whole unit. But this will also mean that global constants are writable.<br>
><br>
> Well, I'm an old dog so I prefer old fashion ways. A variable that retains its value is, from memory point of view, a global variable. I mean, the memory is never freed, it's not freed when it goes out of scope. So, the problem is what to do to limit the visibility to the procedure.</p>
<p>Writable constants *are* the old fashion way, cause this kind of usage stems from Turbo Pascal and allowed to restrict the visibility of symbols.</p>
<p>Regards,<br>
Sven</p>