[fpc-devel] Multiple variable initialization

Ondrej Pokorny lazarus at kluug.net
Sat Mar 24 20:21:04 CET 2018

On 24.03.2018 18:40, Jonas Maebe wrote:
> The C-syntax is indeed consequent, and that is what I referred to: the 
> assignments work the same way as elsewhere in the program, so multiple 
> initialisations are just as clear as single initialisations there. In 
> Pascal, you have a special syntax for initialised variables/constants, 
> and hence extending it to work on multiple variables/fields does not 
> have the advantage that you subconsciously immediately know what 
> happens based on your knowledge of the rest of the language.

I still don't understand how anybody can think that the syntax "var A, 
B: Integer = 0;" is unclear and doesn't immediately recognize that 0 is 
applied both to A and B. Honestly it would never come to my mind if you 
haven't raised this question.

As you Jonas said, Pascal syntax for initialization of 
variables/constants is a special one after all and therefore you do need 
to know it. Explaining/documenting the fact that you can initialize 
multiple variables/constants at once is one extra sentence. Just one 
sentence. In a documentation that you need to read anyway because the 
initialization syntax is unusual.

Anyway, my favorite example of non-pascalish syntax within FPC are the 
+=, -= etc. operators. I really don't understand how they made it into 
FPC if so many FPC developers are stubbornly against simple and helpful 
extensions :)


More information about the fpc-devel mailing list