You've highlighted some very good points and I can honestly say I agree with you completely. I find non-inferred types to be a bit clumsy within loops though, see below.
Type declared explicitly and variable initialized (i1 existence is strictly within loop-only scope, which is a plus):
Code: Select all
for var i1: Integer := 1 to 10 do //
I prefer the inferred type below, looks less awkward syntactically (too bad keyword var
had to stay however):
As far as it being a hassle when you are working within the context of a very large function where you have to constantly check the variable declaration block... this can be annoying as you mentioned. However, I still regularly use Hungarian notation so I'm almost always aware of what the variable type is based on the naming prefix I've assigned the variable. If it's an unsigned int I'll use ul
prefix, for signed ints I'll use i
as the prefix, if it's an int64 I'll use lli
(LONGLONG integer) or perhaps i64
etc. Not everyone is pro Hungarian notation being that its use is subjective, some make the case that it makes code less readable and is messy, but personally I find it useful when I don't have to reexamine the variable declaration block and know simply by looking at the variable name what data type I am working with in the moment.
Everything considered I believe it's a step in the right direction even though it does break strict traditional Pascal conventions and rules. The language itself needs an overhaul otherwise newer promising languages with equal or better performance, more bells and whistles etc., like Rust, will leave Delphi in the dust.