Logical NOT Operator (' ! ') in If-statements.
Logical NOT Operator (' ! ') in If-statements.
Hi.
I'm likely not the first to be missing the conveniences of the Logical NOT Operator (' ! '), ... in If statements. I would be using ' ! ' often if PureBasic supported it. Much more preferable thAn the alternatives;
If Not Bool(String.s) ..., or If String.s = "" ...
If !String.s ...
short and sweet.
I personally think this support would be up there in very useful features to work with in PB.
I'm likely not the first to be missing the conveniences of the Logical NOT Operator (' ! '), ... in If statements. I would be using ' ! ' often if PureBasic supported it. Much more preferable thAn the alternatives;
If Not Bool(String.s) ..., or If String.s = "" ...
If !String.s ...
short and sweet.
I personally think this support would be up there in very useful features to work with in PB.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Re: Logical NOT Operator (' ! ') in If-statements.
Some comments:
1. If Not String.s syntax used to be allowed!! But at some point it became disallowed, and we have to use String = "" or similar. I never really understood that change, many of us used that syntax...
2. The team doesn't like to add many ways to express the same functionality (which I totally understand)
3. ! is already used for bitwise XOR in PB
4. I just use a NotS(String) macro instead
1. If Not String.s syntax used to be allowed!! But at some point it became disallowed, and we have to use String = "" or similar. I never really understood that change, many of us used that syntax...
2. The team doesn't like to add many ways to express the same functionality (which I totally understand)
3. ! is already used for bitwise XOR in PB
4. I just use a NotS(String) macro instead
Code: Select all
Macro NotS(String)
(Bool(String = ""))
EndMacro
Re: Logical NOT Operator (' ! ') in If-statements.
Actually, ! is used to prefix all in-line assembly code, which means this request can't be done at all.kenmo wrote:! is already used for bitwise XOR
Re: Logical NOT Operator (' ! ') in If-statements.
Appreciate your comments guys.
@Dude;
! at line start to have directly an assembly line to the assembler without being processed by the compiler.
It is totally possible to be used in other ways like how it's already the case when working with variables. As kenmo also said, used for the Bitwise XOR operator.
Being used in If-statements Isn't going to confuse the PB compiler one bit.
@kenmo;
1. True, NOT operator used to support Strings. The trade-off is currently.., is six keystrokes to include Bool() to still use NOT operator. Or by the other means, five which includes the two spaces for friendly readability.
2. Convenience should have priority. Think about all the keystrokes programmers would be saved from having to-do. It might look trivial at first glance, but working on nice projects, I imagine you could be saved from large amount of keystrokes by having the Logical NOT Operator in If-statements.
3. Already commented to this with my response to Dude. It's already used in at least two ways in PureBasic currently. However there is no confusion to where and when to use, and why.
4. I was also thinking about the Macro use, but that's still six keystrokes multiplied by the times using in a project. When you go to share your project, you'll have to use multiple posts to include a single project because of the limit posed more so now with the use of the extra characters to accomplish the ! Logical NOT Operator on strings. It's so stressful currently.
I'll continue to use a Macro as a poor substitute to the Logical NOT Operator. I personally and strongly believe my request would be surely very beneficial and well appreciated by great numbers.
@Dude;
! at line start to have directly an assembly line to the assembler without being processed by the compiler.
It is totally possible to be used in other ways like how it's already the case when working with variables. As kenmo also said, used for the Bitwise XOR operator.
Being used in If-statements Isn't going to confuse the PB compiler one bit.
@kenmo;
1. True, NOT operator used to support Strings. The trade-off is currently.., is six keystrokes to include Bool() to still use NOT operator. Or by the other means, five which includes the two spaces for friendly readability.
2. Convenience should have priority. Think about all the keystrokes programmers would be saved from having to-do. It might look trivial at first glance, but working on nice projects, I imagine you could be saved from large amount of keystrokes by having the Logical NOT Operator in If-statements.
3. Already commented to this with my response to Dude. It's already used in at least two ways in PureBasic currently. However there is no confusion to where and when to use, and why.
4. I was also thinking about the Macro use, but that's still six keystrokes multiplied by the times using in a project. When you go to share your project, you'll have to use multiple posts to include a single project because of the limit posed more so now with the use of the extra characters to accomplish the ! Logical NOT Operator on strings. It's so stressful currently.


I'll continue to use a Macro as a poor substitute to the Logical NOT Operator. I personally and strongly believe my request would be surely very beneficial and well appreciated by great numbers.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Logical NOT Operator (' ! ') in If-statements.
I also appreciate that decision by the team, because this way the code is better readable.kenmo wrote:2. The team doesn't like to add many ways to express the same functionality (which I totally understand)
Yes. Allowing to use ! for one more purpose will lead to less readable code.kenmo wrote:3. ! is already used for bitwise XOR in PB
I just usekenmo wrote:4. I just use a NotS(String) macro insteadCode: Select all
Macro NotS(String) (Bool(String = "")) EndMacro
Code: Select all
If s$ = ""
Code: Select all
If s$ <> ""
There actually is nothing else required.

-1 from me for this request.
Re: Logical NOT Operator (' ! ') in If-statements.
! already has more than one purpose WITH PureBasic, and I'm not confused, so what's one more?
I really don't mind if it's another single character, or up-to three characters if necessary. However currently with PB and working with Strings isn't time and finger friendly. Having removed Not operator on Strings leaves us with the alternative and I strongly see as undesirable ways.
Having ! or some quick and convenient NOT Operator support for If-statements, isn't going to make code readability worse. I see this entirely in an opposite way. In any-case anyone old-fashion can continue to use their preferable non-time & finger friendly methods. You have options, don't mean you need to use, like probably number of features in PureBasic. It's available, just because you don't use, don't mean others don't.
I find those who comes on here and responds to people's ' Feature Requests and Wishlists ' posts with negative one, just because they don't have the need for, and see currently the benefits, are thoughtless. Sure express your opinion, or don't post at all, but can do without the negative one after the contrary opinions have been expressed.
I really don't mind if it's another single character, or up-to three characters if necessary. However currently with PB and working with Strings isn't time and finger friendly. Having removed Not operator on Strings leaves us with the alternative and I strongly see as undesirable ways.
Having ! or some quick and convenient NOT Operator support for If-statements, isn't going to make code readability worse. I see this entirely in an opposite way. In any-case anyone old-fashion can continue to use their preferable non-time & finger friendly methods. You have options, don't mean you need to use, like probably number of features in PureBasic. It's available, just because you don't use, don't mean others don't.
I find those who comes on here and responds to people's ' Feature Requests and Wishlists ' posts with negative one, just because they don't have the need for, and see currently the benefits, are thoughtless. Sure express your opinion, or don't post at all, but can do without the negative one after the contrary opinions have been expressed.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Re: Logical NOT Operator (' ! ') in If-statements.
If !String looks just weird for purebasic imho. personally i think it would be better if Not was simply allowed with strings again. never understood that change anyway.
c ya,
nco2k
c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Re: Logical NOT Operator (' ! ') in If-statements.
Weird because it's something to only imagine. There's lot of things that's weird when you can only imagine. I've seen lot of weird requests, and later after they been implemented and I started using, I don't see it as weird anymore.
Weird anyways don't mean bad, different, unusual more like it. In this since, to PureBasic !String does seem weird.
I'm anyways up for even the Not supporting Strings again. Someone want to remind me why It was initially removed in the first place?
Was it to much computing with Not distinguishing between numeric and strings? Or was this to baby-proof programming w/PB?
Weird anyways don't mean bad, different, unusual more like it. In this since, to PureBasic !String does seem weird.
I'm anyways up for even the Not supporting Strings again. Someone want to remind me why It was initially removed in the first place?
Was it to much computing with Not distinguishing between numeric and strings? Or was this to baby-proof programming w/PB?

ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Re: Logical NOT Operator (' ! ') in If-statements.
my guess is that it was probably never meant to work with strings and it just worked by accident. probably had few side-effects because of that. instead of removing it, a proper implemantation would have been much better.Thunder93 wrote:Was it to much computing with Not distinguishing between numeric and strings? Or was this to baby-proof programming w/PB? :lol
c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Re: Logical NOT Operator (' ! ') in If-statements.
Glance I found some who expressed strong emotions for Not operator not supporting strings anymore.
Unwelcome changes with strings in expressions with Bool(), by Mistrel [2013]: http://www.purebasic.fr/english/viewtop ... 13&t=57715
Not in If, by User_Russian [2015]: http://www.forums.purebasic.com/english ... 13&t=61257
and
Logical NOT when comparing strings, by John R. Sowden [2016]: http://www.forums.purebasic.com/english ... 5&p=495873

Unwelcome changes with strings in expressions with Bool(), by Mistrel [2013]: http://www.purebasic.fr/english/viewtop ... 13&t=57715
Not in If, by User_Russian [2015]: http://www.forums.purebasic.com/english ... 13&t=61257
and
Logical NOT when comparing strings, by John R. Sowden [2016]: http://www.forums.purebasic.com/english ... 5&p=495873

ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Re: Logical NOT Operator (' ! ') in If-statements.
@Edit: I made a late and very redundant post unwittingly. Removed.
Last edited by Demivec on Sun Mar 12, 2017 1:00 am, edited 1 time in total.
-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Logical NOT Operator (' ! ') in If-statements.
If you are not confused, that's fine. However, PureBasic was not made exclusively for you, and it just doesn't make any sense to deliberately decrease the readability of a programming language.Thunder93 wrote:! already has more than one purpose WITH PureBasic, and I'm not confused, so what's one more?
As I already pointed out, no syntax change is necessary at all.Thunder93 wrote:I really don't mind if it's another single character, or up-to three characters if necessary.
Oh ... For youThunder93 wrote:Having ! or some quick and convenient NOT Operator support for If-statements, isn't going to make code readability worse. I see this entirely in an opposite way.
Code: Select all
If !string
Code: Select all
If string = ""

Then you maybe should use C as programming language: "Good readable" (in your sense), and pretty "finger-friendly".
Oh, this classic pseudo-argument ...Thunder93 wrote:In any-case anyone old-fashion can continue to use their preferable non-time & finger friendly methods. You have options, don't mean you need to use, like probably number of features in PureBasic.
Of course, I don't have to write !string. But I would have to read it, when other people write it (e.g. here on the forum).
And I don't want to read such weird stuff in PB code, which doesn't make much sense at all.
Your "suggestion for disimprovement" does not become better by accompanying it with thoughtless remarks ad hominem.Thunder93 wrote:I find those who comes on here and responds to people's ' Feature Requests and Wishlists ' posts with negative one, just because they don't have the need for, and see currently the benefits, are thoughtless.
Re: Logical NOT Operator (' ! ') in If-statements.
Hi Little John. I do highly respect you, for obvious reasons. This opinion won't change because of our differences here with this topic. You also absolutely right, two wrongs don't make it right. I could have PM you my concern. To err is human, and that is what I have to heed myself.
That is out of the way. Now...;
* I've never said or think that, that PureBasic was exclusively made for me. That would be so stupid. Remember, at the same time, heed your own words. And try to understand that there's others who misses the Not operator for empty strings checks. It's not only me, and for good reason. I'm only looking for a better way than what's currently offered, whether it's ' ! ' or something else.
That is out of the way. Now...;
* I've never said or think that, that PureBasic was exclusively made for me. That would be so stupid. Remember, at the same time, heed your own words. And try to understand that there's others who misses the Not operator for empty strings checks. It's not only me, and for good reason. I'm only looking for a better way than what's currently offered, whether it's ' ! ' or something else.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Re: Logical NOT Operator (' ! ') in If-statements.
On the flip side this should not work either:But it does. 
Code: Select all
a.s = ""
b.s = "abc"
If a : Debug "a" : EndIf
If b : Debug "b" : EndIf
