[fpc-pascal]typed constants

Peter Vreman peter at freepascal.org
Thu Jan 2 20:08:18 CET 2003

> I thought, the only difference between local typed constants and
> initialized variables will be that
> (a) the "const" declaration implements them as global with just local
> scope and
> (b) "var" would initialize it each time the subprogram is called?
> And especially in case of (b), why should it not be allowed to use
> variable parameters as initialization value?

Simpel answer: the current code was already available for the reading of
typed constants. Only the implicit generation of the assignments was
needed. It took only 30 minutes to get it working.

> Anyway, I would think that an assignment operator ":=" is more
> appropriate for a variable assignment in those cases. It would also
> help to distinguish between both cases then, because people tend to
> write declarations in single const/var blocks, so you cannot tell from
> the first look, if this one is a local typed constant or an initialized
> variable. With the distinction between "=" and ":=" you could do that.

I don't see the problem there is currently a clear distinction. In
statements you need to use := for assignment. And in declarations
(enums,default parameters, typed constants, initialized vars) you need to
use =.

More information about the fpc-pascal mailing list