case not IsNotTrue of true: begin CheckBox1.Checked := True; end; false: begin CheckBox1.Checked := False; end; else raise Exception.Create('...'); end;
As a hardware guy, I can tell you that one of the joys in moving fro TTL to CMOS (many years ago) was the availability of positive logic functions for all gates.
One of my favorites was in C++. The use of the ternary operator: a ? b : c; The actual entries for a, b, and c were each so long as to require horizontal scrolling of the screen.
A negative boolean variable as you name is could be interesting when that variable is added afterward to expand something existing. Frequently, in order to not break existing code which ignore the variable, the variable initial value must be false. This make the name with a negation mandatory.
In fairness, there was a time when all logic hardware involved negation, and many of us found it perfectly straightforward to design in that mode. However, I do agree that as a common practice, it were better to avoid it.
As a student I wanted to design an operating system with some fellow stutents, which would answer wildcard commands like "del *.pas" with prompts like: "you do not want to delete all .pas files do you? (Yes/No)" Needless to say that we intended to call it "SaDOS" :)
Lübbe Onken but would it use spoken English rules or logic rules? Usually when speaking 'don't you want fries?' The answer 'yes' is taken as 'yes I do want them' rather than as agreement.
Reminds me of:
ReplyDeletecase not IsNotTrue of
true: begin
CheckBox1.Checked := True;
end;
false: begin
CheckBox1.Checked := False;
end;
else
raise Exception.Create('...');
end;
Krom Stern Exactly!
ReplyDeleteif not valid
ReplyDeletethen ...
No rules without exception?
Edit: Ahem... you were thinking about the variable and implied state...
if not IsInvalid
then ...
if not (LarsCantSpell and LarsCantRead)
ReplyDeletethen ...
We have one of those that made me chuckle over the years. It reads like this... "if not no_pos_update". You probably never saw that gem :-)
ReplyDeleteRon Lawrence I can't even think like that -- seriously, it's like trying to drive in mud. Just so hard to think about. ;-)
ReplyDeleteAs a hardware guy, I can tell you that one of the joys in moving fro TTL to CMOS (many years ago) was the availability of positive logic functions for all gates.
ReplyDeleteI've mentioned this beauty before
ReplyDeleteif (some long complex condition)
then // Remember Elsie Here
else begin
... actual code
One of my favorites was in C++. The use of the ternary operator:
ReplyDeletea ? b : c;
The actual entries for a, b, and c were each so long as to require horizontal scrolling of the screen.
A negative boolean variable as you name is could be interesting when that variable is added afterward to expand something existing. Frequently, in order to not break existing code which ignore the variable, the variable initial value must be false. This make the name with a negation mandatory.
ReplyDeleteIn fairness, there was a time when all logic hardware involved negation, and many of us found it perfectly straightforward to design in that mode. However, I do agree that as a common practice, it were better to avoid it.
ReplyDeleteif not IsNotTrue then...
ReplyDeletebFixStupidBugFlag = ........
ReplyDeleteIf bIsNotOpposite then....
ReplyDeleteI was going to say what François Piette said.
ReplyDeleteAs a student I wanted to design an operating system with some fellow stutents, which would answer wildcard commands like "del *.pas" with prompts like:
ReplyDelete"you do not want to delete all .pas files do you? (Yes/No)"
Needless to say that we intended to call it "SaDOS" :)
Lübbe Onken but would it use spoken English rules or logic rules? Usually when speaking 'don't you want fries?' The answer 'yes' is taken as 'yes I do want them' rather than as agreement.
ReplyDeleteThat's why it would be called SaDOS. You have to find our yourself...
ReplyDeletebDoNotNeverDoThis := ?
ReplyDelete