Page 1 of 2
not
Posted: Sat May 08, 2004 12:50 pm
by thefool
I know this has been discussed before, but is there going to be a NOT keyword in or before pb 4.0?
Posted: Sat May 08, 2004 1:16 pm
by blueznl
euh, lemme see...
AlphaSND: [12:47] <AlphaSND> blueznl : I will add this 'NOT' statement, don't worry
there's just no telling when
you can always work around it... replace NOT with 0 = and you're done
http://www.xs4all.nl/~bluez/datatalk/pu ... and_binary
Posted: Sat May 08, 2004 1:31 pm
by Flype
there is the "~" statement
you can write for example :
while ~Eol(0) : Wend
Is this a real "not" ?
Posted: Sat May 08, 2004 1:59 pm
by blueznl
no
it's a binary inversion
if the result of something is 22, the inverted result is NOT 0

Posted: Sat May 08, 2004 2:32 pm
by thefool
yeah i also thought about using the ~ but it didnt work.
there is ofcourse some work-around methods (thanks to blueznl. found in his PB survival guide), but a real NOT would be nice.
Posted: Tue May 25, 2004 7:25 pm
by oldefoxx
What do you want NOT to do for you?
Do you want it to take a 0 result and return a 1 or a -1 instead (whichever is your definition of a TRUE state)?
Do you want it to take a non-zero (TRUE) result and return a 0 (FALSE)instead?
See, NOT is LOGICAL operator. It's process is easy enough to emulate in mathematical terms, such as:
a = a = 0
Which will cause 'a' to become a TRUE or a FALSE, the functional inverse of what 'a' was before, although its prior value may not have been specifically a TRUE or FALSE. It might have been 100 for instance. But by resorting to an assignment based on a RELATIONAL evalutation (the second equals sign), we can force a LOGAL result for a. Just as you apparently want for your NOT operator.
Note that there are other reliational operators that can be used in place of the second '=' sign above: '<', '>', '<=', '>=', '<>' are the common ones.
Further, note that FALSE is ALWAYS going to be a zero (0), but some languages represent a TRUE state as either a 1 or a -1, which is only important when you consider using the result in mathematical processes. In practial terms, any non-0 result will be treated as non-false (or TRUE) state.
Posted: Tue May 25, 2004 9:50 pm
by blueznl
oldefox, here's an example:
Code: Select all
a.l = 1
b.l = 0
;
if a
; whatever
endif
;
if not a
; whatever
endif
here's another one...
Code: Select all
if openscreen(....)
; whatever
endif
;
if not openscreen(....)
; whatever
endif
it's just a minor thing to make code more readable, that's all
Posted: Tue May 25, 2004 10:35 pm
by oldefoxx
Oh, I an well aware of how to use the NOT operator. I just don't find it a necessary feature, since it is so easy to get the required resutl with the relational operators. If you look at PowerBasic, it also has two more operators, one called ISTRUE and the other is called ISFALSE. I don't use them either, since they are just not necessary for the same reason.
Posted: Tue May 25, 2004 10:53 pm
by blueznl
it's all a matter of taste

Posted: Tue May 25, 2004 11:22 pm
by oldefoxx
True enough,
However, I hope my example and explanations serve for others to see how to emulate a NOT capability with little difficulty.
Another example involves using an If Else EndIf structure. You can test for some condition, and the Else represents the Not equivalent of that condition.
Posted: Tue May 25, 2004 11:22 pm
by Dare2
* Raises a banner *
banner wrote:
NOT NOW!
NOT NEEDED!
* and starts a march *
I have a taste for not. Readability among other things.
Given the results that
a = b = c can produce (on another thread) then as sure as sure is true, I am sure = (sure = 0) that that is the way to go.

Posted: Wed May 26, 2004 12:18 am
by oldefoxx
Using NOT does not automatically make thing more readable. For instance, if I said "NOT needed OR wanted" (a play on the statement above), what does that really signify? Correct usage in this case (if the meaning is to be extended throughout the phrase is "NOT needed NOR wanted". But that is about english phrases. And what are you going to do, add additional words like NOR, NAND, NXOR to show that the NOT is to be extended to more than the term it immediately preceeds?
Immediately, someone jumps back and says, "Ah, but you can use parentheses to show the range of the NOT, right?" An example then being NOT (needed OR wanted). But that immediately means that you want the NOT to be a unary (effects one term) operator like making a number a minus (you put a hyphen immediately in front of it).
And the trouble with a unary operator like NOT is that then the statement "NOT needed OR wanted" infers that it IS wanted, which goes against the understood meaning of this phrase. And what would a -NOT(a) signify? Or what would NOT NOT a produce as a result? Would the two NOTs cancel each other, and you just get back the value of a, or does each get inacted in order? The problem is, that precidence first decides which operation are peformed first, then operations of equal precidence are generally performed in left to right order. But for NOT NOT to work, one operator would have to be classified as unary, and the other as a lower precidence operator, similar to the - -a sequence. Only you still have to establish where NOT, when it is not a unary operator, falls among the other logical operators (AND and XOR preceed OR in the precidence table).
Equality checks (=) and other rational operators (such as > and <) take precidence over the logical operators (AND, XOR, OR), so it is easy to follow how they work in conjunction to those operators. But NOT then becomes an object of contention while we define the scope, range, and precidence involved. And I guarantee that however you use it, someone is going to find the result confunsing because it will not exactly reflect the english that they are accustomed to reading.
As for the argument that a = a = 0 invites corruption in threads, that is a spurious argument, since you do not have to assign the result to a variable. You can simply do If a=0 and test for the intermediate result without changing the value of the variable.
Posted: Wed May 26, 2004 2:03 am
by Dare2
oldefoxx wrote:NOT needed OR wanted
More banners meaning
banners wrote:
NOT is needed
.. AND ..
OR is wanted (probably by the authorities, for spamming).
But I am still not(convinced) that convinced = convinced = 0 is better readability-wise.
And as I am in now:
1: hijacking a thread
2: spamming
3: Increasing my pointless post count
and in danger of attracting the attention of
The Moderators 8O I will bow out.
BTW, are you related to d'oldefoxx? Now there is a way to keep spam counts down.
Regards. *
DareII *
Posted: Wed May 26, 2004 2:24 am
by El_Choni
Just to prevent you to pop your post counts up: have you ever realized how these funny chips which take account of your level (yes, those black thingies in the left) ressemble cockroaches?
Well, I have. And I don't like roaches too much. However, I keep posting and posting, doesn't matter how I feel about bugs, just to make my post count higher. This is quite weird, isn't it?
Enough. I hope I don't remember this post tomorrow. I'll probably have a headache.
Good night, or whatever, and regards,
Posted: Wed May 26, 2004 3:28 am
by NoahPhense
El_Choni wrote:Just to prevent you to pop your post counts up: have you ever realized how these funny chips which take account of your level (yes, those black thingies in the left) ressemble cockroaches?
Well, I have. And I don't like roaches too much. However, I keep posting and posting, doesn't matter how I feel about bugs, just to make my post count higher. This is quite weird, isn't it?
Enough. I hope I don't remember this post tomorrow. I'll probably have a headache.
Good night, or whatever, and regards,
I second that...
- np