Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2020-01

A more fundamental problem Re: i36507

10 messages · 5 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

J. Gareth Moreton

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.

Gareth aka. Kit

Reply by email

J. Gareth Moreton
to J. Gareth Moreton

P.S. The issue can be found here:
https://bugs.freepascal.org/view.php?id=36507

J. Gareth Moreton wrote 37 lines
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. Gareth aka. Kit _______________________________________________ fpc-devel maillist  -  https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Ondrej Pokorny
to J. Gareth Moreton: So I reported this morning that Lazarus no longer builds as of r43826.  Ondrej was quick…
J. Gareth Moreton wrote 6 lines
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.

Nonsense.

That would mean that adding any new property in any object is a breaking change because the same name can be used in any possible with-statement at any place in any program or any local variable etc.

Short: every new property introduces a risk of clashes.

Ondrej

Reply by email

J. Gareth Moreton
to Ondrej Pokorny

This was not a new property or a recent change to the Lazarus sources though.  I was using an old revision of Lazarus to test optimisations on, and had been doing fine with it until I discovered last night that it would no longer build.  Updating to the latest repository didn't change the file in question. Something in the compiler was changed recently that caused it to break when it was able to handle the clash before.

Gareth aka. Kit

Ondrej Pokorny wrote 22 lines
On 03.01.2020 10:45, J. Gareth Moreton wrote: > 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. Nonsense. That would mean that adding any new property in any object is a breaking change because the same name can be used in any possible with-statement at any place in any program or any local variable etc. Short: every new property introduces a risk of clashes. Ondrej _______________________________________________ fpc-devel maillist  -  https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Sven Barth
to J. Gareth Moreton: So I reported this morning that Lazarus no longer builds as of r43826.  Ondrej was quick…

J. Gareth Moreton schrieb am Fr., 3. Jan. 2020,
10:45:

Show quoted text 33 lines
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

Reply by email

Michael Van Canneyt
to J. Gareth Moreton: This was not a new property or a recent change to the Lazarus sources though.  I was…
J. Gareth Moreton wrote 7 lines
This was not a new property or a recent change to the Lazarus sources though.  I was using an old revision of Lazarus to test optimisations on, and had been doing fine with it until I discovered last night that it would no longer build.  Updating to the latest repository didn't change the file in question. Something in the compiler was changed recently that caused it to break when it was able to handle the clash before.

I seriously doubt this. You probably updated the RTL when updating the compiler.

Michael.

Reply by email

Ondrej Pokorny
to J. Gareth Moreton: This was not a new property or a recent change to the Lazarus sources though.  I was…
J. Gareth Moreton wrote
This was not a new property or a recent change to the Lazarus sources though.

It was a recent change in FPC RTL sources: r43841.

Show quoted text 6 lines
I was using an old revision of Lazarus to test optimisations on, and had been doing fine with it until I discovered last night that it would no longer build.  Updating to the latest repository didn't change the file in question. Something in the compiler was changed recently that caused it to break when it was able to handle the clash before.

There was no clash before. The Options property was introduced yesterday in r43841.

FPC trunk is supported only in Lazarus trunk (and Lazarus stable branch if not forgotten :) ).

Ondrej

Reply by email

J. Gareth Moreton
to Ondrej Pokorny
Ondrej Pokorny wrote 7 lines
There was no clash before. The Options property was introduced yesterday in r43841. FPC trunk is supported only in Lazarus trunk (and Lazarus stable branch if not forgotten :) ). Ondrej

Oh right, okay.  That explains things then.  I would have thought though that it would have been test-compiled before being pushed to the main repository.  Sorry for the confusion - I assumed that Lazarus was guaranteed to build from the trunk.

Gareth aka. Kit

Reply by email

Bart
to J. Gareth Moreton: Oh right, okay.  That explains things then.  I would have thought though that it would…
AM J. Gareth Moreton wrote
Oh right, okay. That explains things then. I would have thought though that it would have been test-compiled before being pushed to the main repository.

No, the fpc devels are not responsible for Lazarus. The adding of TStrings.Options was mandatory (Delphi has it, so we must as well).

Sorry for the confusion - I assumed that Lazarus was guaranteed to build from the trunk.

This happens rather frequently, and cannot be really avoided, and if it happens we fix it in Lazarus trunk (and sometimes in Lazarus fixes as well).
It's not a big deal.

Bart

Reply by email