Re: [Lazarus] AutoCommit

2020-11-14 Thread Ondrej Pokorny via lazarus

On 14.11.2020 18:02, Michael Van Canneyt via lazarus wrote:

On Sat, 14 Nov 2020, Sven Barth via lazarus wrote:

No, cause their intended default value could be True. Thus no special
handling for them.


You can of course say the same for all other types for which an 
implicit 'default'
is implemented. The more so because a class is initialized with 0 in 
which

case every enumerated and boolean will be ord(0) unless otherwise
initialized in the constructor.

So I don't see why this rule is not applied to all properties, I don't 
think

it is logical.


I agree. One would not expect the implicit default values for 
string/real/pointer properties.


And then people wonder why their empty string properties are not streamed:

TMyClass = class
published
  property MyString: string read FString write FString stored 
IsMyStringStored;

end;

constructor TMyClass.Create;
begin
  FMyString := 'abc';
end;

function TMyClass.IsMyStringStored: Boolean;
begin
  Result := FMyString<>'abc';
end;

What's wrong?
-> The nodefault is missing in order the empty string be streamed:
  property MyString: string read FString write FString stored 
IsMyStringStored nodefault;


Not logical, not intuitive, but that is how it works and is documented :/

Ondrej

--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Project Group error ?

2020-11-14 Thread Sven Barth via lazarus

Am 14.11.2020 um 17:17 schrieb Juha Manninen via lazarus:

Regarding issue :
https://bugs.freepascal.org/view.php?id=38011 

People with easy access to Windows, please check if you can reproduce 
the problem?



I've replied in the bug report.

Regards,
Sven
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] AutoCommit

2020-11-14 Thread Michael Van Canneyt via lazarus



On Sat, 14 Nov 2020, Sven Barth via lazarus wrote:


Michael Van Canneyt via lazarus  schrieb am
Fr., 13. Nov. 2020, 22:37:




On Fri, 13 Nov 2020, Ondrej Pokorny via lazarus wrote:


Usually we try to use the "default" feature of the newly added

properties so

that they are streamed only when really set and used. When they are not

used,

the LFM can still be loaded in a legacy version of Lazarus because the

new

properties are not streamed.


I set defaults on all boolean properties of sqlscript, rev. 47412

Strange, I thought that boolean properties were not streamed if they had
value 'false'.



No, cause their intended default value could be True. Thus no special
handling for them.


You can of course say the same for all other types for which an implicit 
'default'
is implemented. The more so because a class is initialized with 0 in which
case every enumerated and boolean will be ord(0) unless otherwise
initialized in the constructor.

So I don't see why this rule is not applied to all properties, I don't think
it is logical.

Michael.
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Project Group error ?

2020-11-14 Thread Juha Manninen via lazarus
Regarding issue :
 https://bugs.freepascal.org/view.php?id=38011
People with easy access to Windows, please check if you can reproduce the
problem?

Regards,
Juha
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] AutoCommit

2020-11-14 Thread Ondrej Pokorny via lazarus

On 14.11.2020 11:26, Michael Van Canneyt wrote:

On Sat, 14 Nov 2020, Ondrej Pokorny wrote:
Then I saw the next chapter "Overriding properties". It wrongly 
described redeclaring of properties as overriding. I fixed that as 
well in r1778.


I think the difference is rather artificial, but if you think this is 
better: great.


You are right. I didn't know one can override also read/write specifiers 
(I thought one must redeclare the property in that case):


  TAncestor = class(TComponent)
  private
    fPropName: string;
  published
    property PropName: string read fPropName write fPropName;
  end;
  TOverride = class(TAncestor)
  private
    fPropName2: string;
  published
    property PropName read fPropName2 write fPropName2; // no type 
declaration

  end;

But anyway as stated in the Delphi docs 
http://docwiki.embarcadero.com/RADStudio/Sydney/en/Properties_(Delphi)#Property_Overrides_and_Redeclarations 
:


/Whether a property is hidden or overridden in a derived class, property 
look-up is always static./


So you are right - there is no real difference in property 
override/reintroduce like there is override/overload/reintroduce 
difference in object methods.


I'll make that more clear in FPC docs.

Ondrej

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] AutoCommit

2020-11-14 Thread Michael Van Canneyt via lazarus



On Sat, 14 Nov 2020, Ondrej Pokorny wrote:


On 13.11.2020 22:37, Michael Van Canneyt via lazarus wrote:

On Fri, 13 Nov 2020, Ondrej Pokorny via lazarus wrote:
Usually we try to use the "default" feature of the newly added properties 
so that they are streamed only when really set and used. When they are not 
used, the LFM can still be loaded in a legacy version of Lazarus because 
the new properties are not streamed.


I set defaults on all boolean properties of sqlscript, rev. 47412

Strange, I thought that boolean properties were not streamed if they had 
value 'false'.
The FPC documentation is spot on about the stored/default modifiers: 
https://www.freepascal.org/docs-html/ref/refsu38.html


Only "/String, floating-point and pointer properties have 
implicitdefault//value of empty string, 0 or nil, respectively. Ordinal 
and set properties have no implicit//default//value./"


Indeed.



I polished the docs section in r1777 a little bit.


Well done, thank you !



Then I saw the next chapter "Overriding properties". It wrongly described 
redeclaring of properties as overriding. I fixed that as well in r1778.


I think the difference is rather artificial, but if you think this is
better: great.

Thank you for your efforts !

Michael.
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus