<> no longer acceptable as a comparison operator

Discuss the future of the AutoHotkey language
User avatar
jeeswg
Posts: 5260
Joined: 19 Dec 2016, 01:58
Location: UK

Re: <> no longer acceptable as a comparison operator

06 Oct 2018, 18:10

= - case-insensitive equals comparison
!= - case-insensitive not equals comparison
== - case-sensitive equals comparison
!== - case-sensitive not equals comparison
nice logical easy to infer and remember progression. 1 equals sign - case-insensitive, 2 equals signs - case-sensitive

<> - case-insensitive not equals comparison
what is the 'case-sensitive' version?
As the Beatles said, five is all you need.

Nice summary, but note:
<> - 'case sensitivity based on A_StringCaseSense' comparison

If you really want a 6th operator: !<> as Helgef suggested. What's *not* to like?

AHK v1:
= - case-insensitive equals comparison
== - case-sensitive equals comparison
!= - 'case sensitivity based on A_StringCaseSense' comparison
<> - 'case sensitivity based on A_StringCaseSense' comparison
!== - N/A

AHK v2:
= - case-insensitive equals comparison
!= - case-insensitive not equals comparison [CHANGED]
== - case-sensitive equals comparison
!== - case-sensitive not equals comparison [NEW]
<> - N/A (current state) [REMOVED]
<> - 'case sensitivity based on A_StringCaseSense' comparison (proposal) [UNCHANGED]

Note: 'case sensitivity based on A_StringCaseSense' would make <> consistent with:
> < >= <=
homepage | tutorials
[code boxes are currently not working 100%]
[click the 'Reply with quote' button on a post to see the full indented text]
Helgef
Posts: 3221
Joined: 17 Jul 2016, 01:02
Contact:

Re: <> no longer acceptable as a comparison operator

07 Oct 2018, 02:52

So zero arguments
:eh:
Look at how many pythonistas want ++ and -- (even though += and -= are available).
++ / += and -- / -= are not the same. != and <> was exactly the same, now that <> isn't available, it is easier for you to make a case for it, since the first step has already been taken, that is, it has been concluded that we do not need both to do the exact same thing, I don't get what you are complaining about.

Cheers.
swagfag
Posts: 1365
Joined: 11 Jan 2017, 17:59

Re: <> no longer acceptable as a comparison operator

07 Oct 2018, 05:44

<> - 'case sensitivity based on A_StringCaseSense' comparison
i dont understand why this would be needed.
StringCaseSense "On" is redundant, because u now have !==.
StringCaseSense "Off" is redundant, because u had != to begin with.
And StringCaseSense "On"/"Locale" already affects !=, so what's the need for <> to fill this niche
If you really want a 6th operator: !<> as Helgef suggested. What's *not* to like?
i dont want a sixth operator nor do i want a fifth. i want a fourth operator and now that we have that we can do away with the rest of the redundant ones
User avatar
jeeswg
Posts: 5260
Joined: 19 Dec 2016, 01:58
Location: UK

Re: <> no longer acceptable as a comparison operator

07 Oct 2018, 07:15

- @Helgef: It seems that you appreciate *now* that removing != makes <> *more* useful/necessary. Did you see things that way before you made the GitHub pull request?

- @swagfag: A_StringCaseSense On/Off/Locale *all* affect > < >= <= (and <>).
- So: 'case sensitivity/insensitivity based on A_StringCaseSense' comparison, might be clearer.
- In the same way that SubStr lets you specify to search text, case sensitive on/off, it can be useful to compare text, case sensitive on/off.

- I maintain around 8 AHK v1/v2 lists/tutorials (possibly more), and as I update them in response to changes, I'm reminded multiple times, 'is this change a good idea', and I also think: 'will there be a clamour to have this change reversed', 'should I bother to update these sources only to re-update them', 'should I leave a note saying this change may be reversed', 'how do I explain/justify script fixes to newbies', 'how complicated are the explanations'.
- I also think back to previous changes and estimate the probability of a reversal.
- Also, 'do I really believe that this change is a good idea, or am I just going along with it, because it doesn't bother me personally very much, even though there may be consequences for other people'. And 'are other people taking everything seriously and considering things or are they just being lazy and irresponsible: it doesn't affect me personally, so who cares, do they even appreciate all of the details of the situation'. And, 'are people just being argumentative for a laugh, on an issue that doesn't affect them'.
- 99% of the time I'm backing changes, and happily doing enormous amounts of conversion, and working on conversion code to help others. E.g. ControlGetFocus changed to return an hWnd, e.g. adding "" in multiple places to force string comparisons.
homepage | tutorials
[code boxes are currently not working 100%]
[click the 'Reply with quote' button on a post to see the full indented text]
User avatar
nnnik
Posts: 3427
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: <> no longer acceptable as a comparison operator

07 Oct 2018, 10:10

I think StringCaseSense should be removed. Global settings such as this decrease modularity - since they cannot be used inside any module without affecting others.
Thats why as far as Im concerned StringCaseSense does not exist. I will not use any code that uses it or relies on its behviors.
If there are specific comparisons for strings they should become seperate functions that are not implemented as a global setting that could potentially break all other parts of a script.
Recommends AHK Studio
User avatar
jeeswg
Posts: 5260
Joined: 19 Dec 2016, 01:58
Location: UK

Re: <> no longer acceptable as a comparison operator

07 Oct 2018, 10:43

- That's a completely respectable position, to say you'd rather not use the A_ variables in that way. (Magic hidden variables that affect functions/operators etc, even without being explicitly mentioned.)
- However, I'd say that doesn't mean you should *remove* functionality, it means you should *avoid* it. (E.g. I sometimes write scripts under certain constraints. But the A_ variables can be convenient: in some programming languages I use a parsing loop, but since A_Index isn't available, I need to increment a variable myself.)
- If you'd said that earlier on, that would have been great. (You probably had this in mind, but I had no idea.)
- It would be an interesting exercise to imagine/list what would be needed to be added to AutoHotkey, to avoid that kind of 'magic unseen variable' use. (I have some custom file loops/registry loops that are nearly finished, using keys instead of A_ variables. More functions/function parameters could replace other A_ variables.)
homepage | tutorials
[code boxes are currently not working 100%]
[click the 'Reply with quote' button on a post to see the full indented text]
iseahound
Posts: 318
Joined: 13 Aug 2016, 21:04
GitHub: iseahound

Re: <> no longer acceptable as a comparison operator

07 Oct 2018, 21:27

Yeah, I gotta be honest, A_StringCaseSense makes no sense. I also like the difference between = and == and for god's sake I hope that I never have to see ===.
User avatar
jeeswg
Posts: 5260
Joined: 19 Dec 2016, 01:58
Location: UK

Re: <> no longer acceptable as a comparison operator

08 Oct 2018, 14:27

@nnnik: A thread for you to savour. I hope you like it and I would welcome your input. Cheers.
bypassing A_ variables - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 17&t=57260
homepage | tutorials
[code boxes are currently not working 100%]
[click the 'Reply with quote' button on a post to see the full indented text]
User avatar
jeeswg
Posts: 5260
Joined: 19 Dec 2016, 01:58
Location: UK

Re: <> no longer acceptable as a comparison operator

16 Oct 2018, 17:43

I came across this post completely coincidentally, the second result when you type 'AutoIt operators' into Google.

Does AutoIT have != or NOTEQUAL logical operator - AutoIt General Help and Support - AutoIt Forums
https://www.autoitscript.com/forum/topi ... -operator/
Language Reference - Operators
https://www.autoitscript.com/autoit3/do ... rators.htm
homepage | tutorials
[code boxes are currently not working 100%]
[click the 'Reply with quote' button on a post to see the full indented text]

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: No registered users and 7 guests