There are I think exactly 2 use cases where inline variables would be useful:
1. for For loops, because here you usually use the typical iterator names (i, j, k, m, etc.) and these are only used for this single loop, and having them in your variable definition just takes space without adding much information.
Also right now you are restricted to having only one type, inline variables would allow:
for var i: Integer in IterateIntegers do
for var i: QWord in IterateQWords do
Today if you have such a situation you need to to have seperate itaration variable for the other loop, and it happend to me more than once that I accidentally wrote the name of the variable of a previously used loop (I often just brainlessly type "i" as iterator variable, because I'm so used to it). Because those variables are available in the same function, it is easy to accidentally use them and it compiles happiely and you wonder why nothing is working.
The second point is for scoped lifetime, as managed records now provide the capability to have automatic lifetime management,
one could imagine writing to a file like that:
FileStream.Open(FileName);
FileStream.WriteLn('Hello File');
The problem is that the finalizer will only be called at the end of the function, meaning the file will stay open until then. So a solution to this may be to use scopes:
with var FileStream: TFileStream do
begin
FileStream.Open('FileName');
FileStream.WriteLn('Hello File');
end;
Aside from these two I don't see much reason to do so. When you are at a point where you have so many variables that you may get confused and need to introduce scoping, that is usually a sign that you are having to much code in one function, and should rather split it up into multiple functions.
Note that you can also use nested functions to retain scope:
procedure Foo(param: Integer);
var
x: Integer;
procedure PrintXAndParam;
begin
WriteLn(x, param); // As nested function it has access to the variables defined before it and to the parameters
end;
begin
x := 42;
PrintXAndParam;
end;
That said, I think you should design your program in a way that you encapsulate your functionality such that you don't need to rely on much state anyway.
I have never found a program where a really big function was actually necessary and could not be encapsulated into multiple smaller functions.
Note that not having inline variable definitions was a key design decision for pascal by Wirth, where other languages at the time where not going that route, and the reason for this is that it can keep the code cleaner. That said of course if you have giant functions with paragraphs of variable definitions in the front, this can have the opposite effect, but as I said, in this case you should cleanup your code and not try to "fix" the language to work better with messy code.