While I use inline variables often in Delphi, I have to say that this doesn't always improve code readability.
There is no doubt in my mind that inline variables can be misused (particularly in Delphi), resulting in code that is not as easy to understand as could be but, I have not seen that often.
It's an opportunity that should be used wisely.
Agree. Just like every other feature the language offers, not just that one.
And the comparison with C/C++ is apt: in many C/C++ source files, you see scattered variables defined almost randomly, and reading the entire set isn't always easy.
I _very rarely_ see inline variables abused/misused in C/C++ code, very much unlike the preprocessor that is very often misused/abused... I mention that because misusing inline variables isn't easy (unlike abusing/misusing the preprocessor.) I believe the misuse of inline variables would be obvious even to a beginner, which is why misuse/abuse of inline variables is very seldom seen (at least in C/C++, I don't really know in Delphi.)
This doesn't happen in Pascal, and the ability to use inline variables could lead to this "drift."
What happens in Pascal is that there are _often_ variables at the global function level that should NOT be at that level, instead they should be _local_. A very commonly seen example of that are index variables (such as "i"), those indexes should NOT be function global, they should be local to the loop (for _more_ than one reason.) The inability to define those indexes locally is a major deficiency in the Pascal language.
As always, it's the programmer who decides whether to write good code or not, it's not the novelty itself.
That's true but, there are features, in the case of inline variables a structural feature, that _enables_ the programmer to write better, cleaner, simpler code and, that structural feature is missing in Pascal (and poorly implemented in C/C++, of course, that's no surprise but, at least they have something that does the job, even if not as well as could be.)
(As per the guidelines for the Linux kernel, may I add)
And how do they justify that ? Is that some commandment ordained by a higher power appearing next to a burning hard drive ? or is there a _logical_ solid foundation to justify it ?
Just in case, are you saying that _nowhere_ the Linux kernel uses something like "for (int i = 1; i < SomeValue; i++) { some code here }" because the declaration of "i" in the "for" itself is an inline variable declaration. I find it very difficult to believe that's not used in the Linux kernel or any other Linux-related C/C++ program that does something useful. From what I've seen that type of inline variable in C is probably more common than a Papiermark unit was in the early 1920s.
Dogma is worthless and there is way too much dogma in programming.