Say I had a function such as this one
procedure TMyObject.DoSomething(text: string);
begin
// do something important with the text
end;
When I call the method like so
DoSomething('some text', );
the code editor displays a red squiggly at the comma after the last parameter, just as I would have expected. The compiler, however, accepts this code and everything works as if the comma wasn't there.
Why does this appear to be legal syntax? Is there some historical reason this is still supported today (I have tried this in Delphi 2006 and others seemed to have experienced it in 2007 as well)?
That codes results in a compile error (E2034 Too many actual parameters) in Delphi 6, 2010 and XE2. I guess it's a compiler bug in your version since it is not legal syntax.