Type inference for scoped enumerations
If I assign a value to a variable of most simple data types I just assign a value, e.g.
AInteger := 1;
ADouble := 1;
AString := 'Hello';
etc. There's no need to specify a type:
AInteger := Integer.1;
However, with scoped enumerations commonly used especially in FireMonkey I do need to specify the type:
Layout1.Align := TAlignLayout.Client;
This is very wordy, frequently catches out newbies and means I often have to look up type names.
Instead the compiler should know what type I am assigning to (or passing a parameter to) and /infer/ the type of the enumeration from that:
Layout1.Align := Client;
Mike Sutton commented
Sorry Marco, I have almost zero knowledge of C#.
Interesting idea. Do you know of C# (that has scoped enumerators) supports the same concept? Not that it matters, just asking.
I'm more inclined to think the editor should make super easy to type that code, compared to what is today...