Hi
I am new to this forum, and to Free Pascal, but not to Pascal. I started programming in 1970, and I used Turbo Pascal to write the analysis software used for my doctoral dissertation. I then used Delphi for several years, before moving on (and perhaps backwards) to Java around 15 years ago. So here I am at an advanced age still working, and still doing some computer programming (as part of my analytics job).
I am looking for a modern programming language to use to build analytics capabilities for my organization. Some of those capabilities require user interfaces. I would really like to jump in and use Free Pascal (I work on Linux mostly but most of my users use Windows) and I really only have two issues with it. And one of them is the lack of an ability to use inline variable declarations (I do not want and do not totally believe in the value of type inference so that is not an issue for me). (FYI, I have used C++ and get a sick feeling in my stomach every time I think of that experience, and have looked at Rust, Golang, Kotlin, and Swift and found them all to be wanting for my purposes.)
So why do I feel that inline variable declaration is so important? From a very practical perspective, less lines of code makes for easier to understand and support code. If I can save 10 lines of variable declarations by using inline variable declarations it makes it easier for me to follow the whole piece of code. And I would venture to say for most other people to follow, not only because there are less lines of code, but also because variable declarations can in many cases be closer to where the variables are being used.
I am sure that there are many reasons for not using inline variable declarations (though I cannot think of them right now). So, why not allow individuals or organizations to choose their own coding standards. I would be willing to bet a pitcher or two of beer that most would want to use inline variable declarations, but that would be their choice.
In my mind, the best reason for not implementing inline variable declarations, is that it would be hard to do so. I am not a computer scientist and I do not have experienced developing compilers so I would not know for sure whether that would be the case. But I did take an introduction to computer science course with Alan Perlis (and if you do not know who he is it might be interesting for you to find out by googling him) sometime around 1984-1985 while a doctoral student at Yale University. And I seem to remember that in most compilers all local variables are declared in a stack frame on the stack. Which suggests to me that it might not be so hard to allow new variables to be added to the stack frame at any time, and that the biggest issue might be to make sure that these new variables are not referenced before that point in time. This in turn might constrain that variable declarations would need to occur in an unambiguous manner before they are being used (but I leave that for the computer scientists).
I have one other comment, which has to do with the declaration that the compiler team would not agree to to make this change. And this comment is meant to be constructive. If the community (which I just joined and thus have little say in it) wishes for a feature to be added, perhaps the role of the development team should be discuss the relative merits of implementation of the feature, and the feasibility of the feature, but to then support the decision of the community as to whether the feature is actually implemented. To me, that is what volunteering and community are about, and yes, in my many years of living on this beautiful planet, I have done a little volunteering.
Phil Troy
P.S. Apparently one of Dr. Perlis's famous quotations is "Fools ignore complexity. Pragmatists suffer it. Some can avoid it. Geniuses remove it." So I suggest that we do our best effort to remove the complexity involved in trying to follow long programs by carefully identifying language features that make those programs shorter without making them more complex.