Board index » delphi » RFC: Type inference
m. Th.
![]() Delphi Developer |
RFC: Type inference2008-06-16 05:33:08 PM delphi42 Hi guys, Many fellows around here ( ;-) ) asks about type inference in Delphi. See en.wikipedia.org/wiki/Type_inference for more details. The proposed syntax would be: 1.) For variables: var foo; //inferenced a, b, c: string; //normal vars i, j, k: integer; //more normal vars ... 2.) For procedures: procedure Foo(bar, var baz; aNormalArg: integer); FTR, we have already some 'oddities' in Delphi related to our theme: Read([var F: File;] V1, V2, [..VN]); //a true 'magic' declaration :-) //the same stands for Write Val(S: string; var V; var Code: integer); //what's the type of 'V'? Str(x: [:Width[:Decimals]; var S: string); //wheeee...!!! 3.) For functions: function Foo(bar, var baz; aNormalArg: integer):; ...here I am not so sure about the syntax. I put the : at the end to show that the result is inferenced. But perhaps isn't so readable? Comments? Thoughts? -- m. th. |