![delphi language delphi language](https://codetalk.co.nz/wp-content/uploads/2016/04/DelphiProgramming4Beginners.png)
Inline declared variables should have block scope : Var x := TStringList.Create // it's a TStringList, no need to declare the type Var x : TStrings := TStringList.Create //no type inference Inline variable declaration, with type inference and block scope Type Inferenceīenefits : less ceremony when declaring variables, still easy to understand.
DELPHI LANGUAGE CODE
Local Variable InitialisationĪllow initialisation of local variables when declaring them, eg :īenefits : 1 less line of code to write/maintain, per variable, initial value is shown next to the declaration, easier to read. Ok, so lets get to it, these are not listed in any particular order. I don't have any suggestions for how any of these features would be implemented in the compiler, having not written a real compiler before I know my limitations! I have not listed any functional programing features here, I have yet to spend any real time with functional programming, so won't even attempt to offer suggestions. Trying to invent a syntax just to be different is pointless, just borrow ideas as needed from other languages (just like they did from delphi in the past!) and get on with it! The reality is that most developers these days don't just work with one programming language, they switch between multiple (I use Delphi, C#, Javascript & Typescript on a daily basis, with others thrown in on occasion as needed). Lots of the examples below borrow syntax from other languages, rather than try to invent some contrived "pascalish" syntax. That's true, in fact we don't need any language if we are ok with writing binary code! If a feature is sugar, and it helps me write less code, and it's easier to read/comprehend/maintain, then I love sugar, load me up with sugar. Another argument put forward is "feature x is just syntactic sugar, we don't need it". My answer to that is, if you don't like it don't use it!! There are many features in Delphi that I don't like, I just don't use them, but that doesn't mean they should be removed.
![delphi language delphi language](https://delphi-books.com/covers/500x0/Delphi-Programming-The-Ultimate-Beginners-Guide-to-Learn-Delphi-Programming-Step-by-Step.jpg)
I have often seen comments about language features where people don't want the c#/java/whatever features polluting their pure pascal code. I have tried to focus on language enhancements that would have zero impact on existing code, i.e.
![delphi language delphi language](https://d28rbn44lsuj1h.cloudfront.net/fr-img/340x200/d/delphi.wikia.com.png)
These days I prefer to write less lines of more expressive code. Many of these potential features would help reducing verbosity, which helps with maintainability. I have several abandoned projects on my hard drive that were only abandoned because what I wanted to do required language features that just didn't exist in Delphi, or in some cases, the generics implementation fell short of what was needed. Some of the features I list below have the potential to spur on the development of other new libraries which can only be a good thing. Those two language features alone enabled a raft of libraries that were simply not possible before, for example auto mocking (Delphi Mocks, DSharp), dependency injection and advanced collections (Spring4D). Probably the biggest change was the addition of Generics and Anonymous methods. Yes there have been some changes, but they were mostly just tinkering around the edges. The Delphi/Object Pascal language really hasn't changed all that much in the last 20 years. TL DR - The Delphi language is very verbose, dated and unattractive to younger developers.