[fpc-pascal]typed constants

Vinzent Hoefler JeLlyFish.software at gmx.net
Thu Jan 2 14:32:19 CET 2003


On Thursday 02 January 2003 04:28, Michael.VanCanneyt at Wisa.be wrote:

> So the following will be allowed
>
> program recurs;
>
> Procedure doit (N : Integer);
>
> Const
>   C : Integer = 1;
>
> Var
>   A : Integer = 0;

Is this a typo? This should be

|A : Integer := 0;

shouldn't it? I mean it is a variable, so you can only *assign* an 
initial value to it instead of setting it equal to some value.

Ok, one could argue, the (local) typed constant thing *is* a variable, 
too, but at least we *call* it constant, even if in real world it is 
not. IMO it would be more consistent to not allow a variable to be set 
with the "=" operator. Consider this:

|Var
|  A : boolean = C = D;

Looks a little bit crazy to me.


Vinzent.

-- 
God is a polytheist.




More information about the fpc-pascal mailing list