#1 2021-01-18 13:09:44

tbo
Member
Registered: 2015-04-20
Posts: 349

GitHub Commit 5db3e8e...

I have a question around the naming of the new parameter to function BinarySave(). Why not name the parameters "Crc32Trailer" or "WithCrc32Trailer"?

function BinarySave(Data: pointer; Info: PRttiInfo; Kinds: TRttiKinds;
  NoCrc32Trailer: boolean = true): RawByteString; overload;  //==> WithCrc32Trailer: boolean = false

Then you don't have to write the following:

if not NoCrc32Trailer then
  W.Write4(0); 

I always have a bad feeling about an identifier that starts with "No...". You have to think exactly opposite to what you feel.

With best regards
Thomas

Offline

#2 2021-01-18 15:37:52

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,548
Website

Re: GitHub Commit 5db3e8e...

It was because there is already such a parameter, with the same name, so we stayed in synch.

But you are right that NoSomething: boolean may be confusing.

We may indeed need change the boolean everywhere...
Check https://github.com/synopse/mORMot2/commit/be24bbf50

Offline

Board footer

Powered by FluxBB