[fpc-devel] A more fundamental problem Re: i36507

Sven Barth pascaldragon at googlemail.com
Fri Jan 3 11:07:30 CET 2020


J. Gareth Moreton <gareth at moreton-family.com> schrieb am Fr., 3. Jan. 2020,
10:45:

> Hi everyone,
>
> So I reported this morning that Lazarus no longer builds as of r43826.
> Ondrej was quick to update the Lazarus sources to allow it to build
> again and marking the issue as fixed, but the underlying regression in
> the Free Pascal Compiler still exists.
>
> Basically, the compiler failed on constructs like this
>
>    with
> InputHistories.HistoryLists.GetList('BuildExecBefore',true,rltCaseSensitive)
>
> do begin
>      Assign(ExecuteBeforeCommandComboBox.Items);
>      Push(Options.ExecuteBefore.Command);
>    end;
>
> The fix was to replace it with the following
> (ide/frames/compiler_compilation_options.pas - line 394):
>
>    HL :=
>
> InputHistories.HistoryLists.GetList('BuildExecBefore',true,rltCaseSensitive);
>    HL.Assign(ExecuteBeforeCommandComboBox.Items);
>    HL.Push(Options.ExecuteBefore.Command);
>
> Given the "illegal qualifier" errors that appeared, I'm guessing the
> issue is that "Options" is also a property of the THistoryList class as
> well as a local variable.  Technically speaking though, this is a
> regression unless it's to be documented (and hence break backward
> compatibility) that if you have a property and a local variable of the
> same name, the property takes precedence.
>

This is simply how "with" works and one of the reasons why it is not
considered good or safe by many.

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20200103/f735a7c0/attachment.html>


More information about the fpc-devel mailing list