I do not like inline variables because of the bad debugging feeling experience in languages that support them.
The way I see it there are 2 reasons for users asking such a feature:
1) To avoid jumping each time to var section when you need new variable in the middle of some lengthy method
2) To quickly see variable type when variable is in the middle of the code and you are looking at the code or debugging it - and you want to avoid jumping to var section
First can be solved with the editor that on your request just asks for the type of a variable and automatically adds it into var section. Second can be solved by showing some on mouse hint with variable type in both editor and debugger.
Most native compiled languages having inline variables were made in the time when we had 25x80 character terminals without any graphics, so today's perspective is different and we have much better ways to address the problem then breaking the pascal spirit.
As for inline variables in for loop:
for var i: integer := 1 to 10 do
I am much more tolerant to such request although it is just a softer version of the general inline variables. I don't like it much, but I can look at it in the code without bad feeling in the stomach.
Although I see the advantage that in suggested example loop variable is not limited to integer types, I guess that most of it's use would be limited to that. Therefore, I would prefer to see this instead:
That would be more in the spirit of pascal, and it would stay a readable sentence - which is in my opinion a crucial pascal feature. Of course, instead of 10 you could use any already declared integer like variable. It would have limited use (no easy way to reference counter in
for-loop code), so at the end not that much needed either.
However I do think that we are missing some syntax sugar. For example implementing unified
try-except-finally block would bring more clarity to complex code since FreePascal does not have garbage collector and we already have to use
try-finally block in order to avoid memory leaks and make sure that each object creation always ends with destruction:
try
..
except
..
finally
..
end;