[Lazarus] How well should Lazarus check method parameters?

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Thu Feb 23 10:17:10 CET 2012


Mattias Gaertner wrote:
> On Thu, 23 Feb 2012 09:54:52 +0100
> Sven Barth <pascaldragon at googlemail.com> wrote:
> 
>> Am 22.02.2012 22:49 schrieb "Mattias Gaertner" <nc-gaertnma at netcologne.de>:
>>> On Wed, 22 Feb 2012 20:55:01 +0000
>>> Mark Morgan Lloyd <markMLl.lazarus at telemetry.co.uk> wrote:
>>>
>>>> I've just spotted this in my code:
>>>>
>>>> procedure FormCloseQuery(Sender: TObject; CanClose: boolean);
>>>> ..
>>>> procedure TListForm.FormCloseQuery(Sender: TObject; CanClose: Boolean);
>>>>
>>>> Those were inserted by some old version of the IDE, presumably the
>>>> current version inserts the missing var.
>>> I don't remember such a bug, but I'm not sure. Maybe it was there for a
>>> very short time and you were just unlucky.
>>>
>>>
>>>> Shouldn't either the IDE or the runtimes pick up this error?
>>> It's valid code. What do you expect?
>> Huh? And what will happen if this handler gets assigned to OnCloseQuery
>> through the LFM?
> 
> The TReader can not find "procedure FormCloseQuery". It can only find
> methods in TListForm.

I might be missing something to my discredit, but this *is* in the 
TListForm:

type

   { TListForm }

   TListForm = class(TForm)
     Bevel1: TBevel;
     DialogFind: TFindDialog;
     DialogFont: TFontDialog;
     MenuItem1: TMenuItem;
..
     procedure FormCloseQuery(Sender: TObject; CanClose: boolean);
..
   public
     { public declarations }
     GlobalState: TGlobalState;
   end;

var
   ListForm: TListForm;

Comments in the code suggest that I was using whatever version was 
current in around '06 or possibly a bit older.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]




More information about the Lazarus mailing list