[wish] Wish delete = for comparing strings

Discuss the future of the AutoHotkey language
User avatar
V2User
Posts: 195
Joined: 30 Apr 2021, 04:04

[wish] Wish delete = for comparing strings

Post by V2User » 24 May 2021, 07:14

@lexikos
Wish delete = for comparing stings and use = to replace := for assignment.
As case-insensitive comparison is not supported by any other languages and we can indeed use == with strLower as the alternative, = really seems redundant. So, why not change := to = so that we can save lots of unnecessary inputs and truly improve the development efficiency? At present, we have to extra press a "Shift" plus a ; and then extra release the "Shift" to press = for every assignment which is everywhere.
Note: since V1 and V2 have already been two very different languages, the V2 language will never have the necessity to keep any similarity or any compatibility with V1. This applies to := too which has already been the ugly historical relic of AHK V1 indeed. We could even change V2 to JS as you've posted in April. All in all, there are truly no worries to change I think. Let's just throw it away and be brave to change := to =.
Last edited by V2User on 22 Nov 2022, 00:01, edited 8 times in total.

User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: [wish] Wish delete = for comparing strings

Post by nnnik » 26 May 2021, 02:04

So, why not change := to = so that we can save lots of unnecessary inputs and greatly improve the development efficiency. At present, we have to extra press a "shift" plus a ; for every assignment which is everywhere.
Most work in coding does not stem from typing an extra : before =.
Recommends AHK Studio

arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

Re: [wish] Wish delete = for comparing strings

Post by arcticir » 26 May 2021, 07:32

I don't think ":=" makes much of an impact, probably because I use hotkeys to enter it.
But I also agree with using "=" for assignment, "==" for comparison, and "#=" or " '=" for case-sensitive comparison. When I switch from other languages to Ahk, the most common mistake I make is to use "=" for assignments. It's very counter-intuitive.
Of course, even if we insist on using ":=", it doesn't seem to do much harm. the most painful thing for me in V2 is the function name "VarSetStrCapacity", which is too long and meaningless. I use it a lot, and it's a pain in the ass for me. :(

User avatar
Onimuru
Posts: 107
Joined: 08 Sep 2018, 18:35
Contact:

Re: [wish] Wish delete = for comparing strings

Post by Onimuru » 26 May 2021, 08:59

Most work in coding does not stem from typing an extra : before =.
I don't think you should be so dismissive of this idea. v2 creates the perfect opportunity to do away with that unnecessary operator and just use the standard = operator since backwards compatibility is clearly not an issue. I think OPs suggestion is an excellent idea and well put.

SandyClams
Posts: 63
Joined: 02 Jul 2020, 11:55

Re: [wish] Wish delete = for comparing strings

Post by SandyClams » 26 May 2021, 14:31

personally I like the little walrus. There's already a precedent in Python, maybe other languages too, not to mention AHK v1, for the operator to specifically signify an assignment expression which evals to the value being assigned. I think this helps make it self-descriptive just by looking at it, which I think is nice, particularly for people who are just learning v2 and/or coming from v1.

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: [wish] Wish delete = for comparing strings

Post by swagfag » 26 May 2021, 16:06

ure two months too late making this thread

arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

Re: [wish] Wish delete = for comparing strings

Post by arcticir » 26 May 2021, 16:44

@swagfag
I don't think it's too late.
People usually become conservative and cautious after the beta version, not now.

lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: [wish] Wish delete = for comparing strings

Post by lexikos » 26 May 2021, 22:48

I'm not considering any more fundamental syntax changes at this point, regardless of any other arguments. If a change hasn't been made in 10 years of alpha development, it can wait for another major release (or indefinitely).

v2 has already been using these operators for 10 years, and v1 for longer. You may have the habit of using = for assignment with expressions from other languages, but AutoHotkey ostensibly isn't aimed at users with experience in other languages. Many users of v2 have experience in v1, and habits formed from there (or in v2). It is not a simple matter of "compatibility doesn't matter", but of cost vs benefit.

There have been other arguments against = for assignment (yes, of course this has been discussed before). Changing = to assignment would be a bigger cause of errors, as it is even in other languages where = hasn't ever been comparison (or a different type of assignment!). As it is, if you try to use = for assignment (at the start of a line), you will usually get an error rather than an expression which does the wrong thing.

arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

Re: [wish] Wish delete = for comparing strings

Post by arcticir » 26 May 2021, 23:08

@lexikos
As a V2 user, I think I am brave to face all changes, even if it requires breaking existing habits.
It will be a huge change, but also an opportunity, and I think we should not ignore the benefits it brings because we are afraid of its drawbacks.
I understand your concern very well. Can we take more input from V2 users, for example by voting to choose whether to make this change or not? (Sorry to be so insistent, but this is really the last chance)

SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: [wish] Wish delete = for comparing strings

Post by SOTE » 26 May 2021, 23:35

V2User wrote:
24 May 2021, 07:14
This applies to := too which has already been ugly historical relic of AHK V1 indeed. We could even change V2 to JS as you've posted in April. All in all, there are truly no worries to change I think. Let's just throw it away and be brave to change := to =.
Your post denigrating := and its usage in AutoHotkey is misplaced and probably more about personal bias. Many well known programming languages have used it and for assignment. You can go back all the way to Algol (the granddaddy of many languages). This includes Python adopting it recently (which they call the walrus operator) and Go (though in a kind of odd way for declaration), and they are top 10 ranked languages. So you can't argue there isn't popular languages using it. The list of other notables, besides AutoHotkey, are Pascal/Object Pascal/Delphi (which has hit as high as number 1 and still is top 15), Ada, Smalltalk, Eiffel, PL/SQL, and PLC Structured Text (Programmable Logic Controllers). So clearly AutoHotkey is in good company. Note- the languages Red and Rebol, mentioned on these forums, do assignment different too.

The other argument about using := for assignment is clarity and technical correctness. = is for equality and comparison in mathematics. Using for assignment is actually what created confusion. == and === is arguably ridiculousness, because of incorrectly using = for assignment. It's really not that hard to figure out or get used to :=, if the person is open-minded.

I think the point of AutoHotkey is not to copy C or JavaScript exactly, but to have its own identity as an automation and general purpose programming language. Though I do agree with the sentiment of AutoHotkey "shadowing" and integrating with JavaScript (with possibly an eye on Go and Swift too). Additionally, AutoHotkey being a little different can allow AHKers to be more flexible in jumping to or using non C-family languages. Python, Object Pascal, Ada, Smalltalk, Lua, PL/SQL, PLC Structured Text are relevant in programming.
Last edited by SOTE on 27 May 2021, 21:04, edited 3 times in total.

iseahound
Posts: 1444
Joined: 13 Aug 2016, 21:04
Contact:

Re: [wish] Wish delete = for comparing strings

Post by iseahound » 26 May 2021, 23:48

:= defines
= equals
: in
is identical to

Now my greatest fear is the dreaded triple equals === from javascript. As you know, AutoHotkey's equality comparison understands the string zero as the integer zero. "0" = 0 So if someone comes along and wants to check types as well as values, and you already have equals as assignment... You'll get the dreaded triple equals. At least with the current schema double equals can possibly be extended to type checking in the future.

User avatar
vvhitevvizard
Posts: 454
Joined: 25 Nov 2018, 10:15
Location: Russia

Re: [wish] Wish delete = for comparing strings

Post by vvhitevvizard » 27 May 2021, 04:08

This issue keeps coming up and the majority would vote for = instead of :=. There r not so many Pascal's syntax admirers. :)
Having ONLY 2-symbols comparison operators (==, >=, !=, etc) is completely logical and javascript-like triple equals === for strict comparison is okeyish, too.

PS: == vs =: comparison vs assignment use frequency is like 20 vs 80.

User avatar
V2User
Posts: 195
Joined: 30 Apr 2021, 04:04

Re: [wish] Wish delete = for comparing strings

Post by V2User » 27 May 2021, 06:49

iseahound wrote:
26 May 2021, 23:48
Now my greatest fear is the dreaded triple equals === from javascript. As you know, AutoHotkey's equality comparison understands the string zero as the integer zero. "0" = 0 So if someone comes along and wants to check types as well as values, and you already have equals as assignment... You'll get the dreaded triple equals. At least with the current schema double equals can possibly be extended to type checking in the future.
"0" = 0 is what intends to abandon and == can be just remained what it was as before.

gregster
Posts: 9002
Joined: 30 Sep 2013, 06:48

Re: [wish] Wish delete = for comparing strings

Post by gregster » 27 May 2021, 06:52

I say: Save the walrus! := Save the quirk!

User avatar
V2User
Posts: 195
Joined: 30 Apr 2021, 04:04

Re: [wish] Wish delete = for comparing strings

Post by V2User » 27 May 2021, 07:34

lexikos wrote:
26 May 2021, 22:48
Many users of v2 have experience in v1, and habits formed from there (or in v2). It is not a simple matter of "compatibility doesn't matter", but of cost vs benefit.
@lexikos
To be honest, none of any other languages are what I get used to. And even no languages are what I'm familiar with except AHKV2, which is considered to be my first language after knowing a little python. I have no idea which syntax is more suitable and elegant. But I know which syntax is less words and more utilitarian. If you think the biggest reason making you not consider it is that many users don't want to change their old habits in V1 or easily get confused on =, so, how about having a vote? And more than 70% in favor, you reconsider?
So fortunately, two months, which is remained for V2 alpha, are just barely enough to seize the last chance to make the change and make V2 more concise.
Lastly, I am sorry that I can not come here and write the post much earlier to get much more time for deciding.
lexikos wrote:
26 May 2021, 22:48
If a change hasn't been made in 10 years of alpha development, it can wait for another major release (or indefinitely).
Last edited by V2User on 28 May 2021, 09:20, edited 9 times in total.

User avatar
V2User
Posts: 195
Joined: 30 Apr 2021, 04:04

Re: [wish] Wish delete = for comparing strings

Post by V2User » 27 May 2021, 07:40

vvhitevvizard wrote:
27 May 2021, 04:08
PS: == vs =: comparison vs assignment use frequency is like 20 vs 80.
Nothing wrong. This is what I totally agree.

gregster
Posts: 9002
Joined: 30 Sep 2013, 06:48

Re: [wish] Wish delete = for comparing strings

Post by gregster » 27 May 2021, 08:54

@V2User: Talking about votes - is there a specific reason that you don't use your main account for this request ?
I mean, it's against the forum rules - and it is just not a good look while you are arguing for a poll...

iseahound
Posts: 1444
Joined: 13 Aug 2016, 21:04
Contact:

Re: [wish] Wish delete = for comparing strings

Post by iseahound » 27 May 2021, 08:55

Yes, but the fact remains that x = x + 1 is a mathematically impossible statement, and everyone learns math.

SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: [wish] Wish delete = for comparing strings

Post by SOTE » 27 May 2021, 20:25

iseahound wrote:
26 May 2021, 23:48
Now my greatest fear is the dreaded triple equals === from javascript.
We should note that =, ==, and === causes massive amounts of confusion in JavaScript. Just from the mistyping alone, never mind the confusion over equality vs assignment and so on. With = vs ==, doing much the same in C/C++. So, bringing that confusion over to AutoHotkey will not be an improvement. It will likely already be contentious enough (in a Python 2 vs Python 3 kind of way), with the script breaking changes of AutoHotkey v2. Making it more unfamiliar, will likely not serve it well. If people want to use C/C++ or JavaScript, there is nothing stopping them from doing so more directly. There is arguably no need to make AutoHotkey more of a clone of what already exists. Probably it was originally decided to use := for assignment in AutoHotkey for clarity, which is a good decision from a logical and technical point of view. As noted, creators of other prominent programming languages agreed with such thinking.
vvhitevvizard wrote:
27 May 2021, 04:08
This issue keeps coming up and the majority would vote for = instead of :=. There r not so many Pascal's syntax admirers. :)
I think we should not confuse familiarity, that helps perpetuate popularity versus what is more logical and makes more technical sense. As for Pascal/Object Pascal/Delphi, it's not the only programming language using := (Go, Python, Ada, Smalltalk, Eiffel, PL/SQL, PLC Structured Text), so maybe it's not fair to frame an opposing argument in such a way. I've also never quite understood the bias against languages that don't look enough like C/C++. We have to allow for creativity and different design philosophies.

User avatar
V2User
Posts: 195
Joined: 30 Apr 2021, 04:04

Re: [wish] Wish delete = for comparing strings

Post by V2User » 27 May 2021, 21:35

gregster wrote:
27 May 2021, 08:54
@V2User: Talking about votes - is there a specific reason that you don't use your main account for this request?
I mean, it's against the forum rules - and it is just not a good look while you are arguing for a poll...
Nothing to correct except I am new as a post writer and half year as a reader in this forum. It's my main account otherwise I would certainly have posted it much earlier. := will be used everywhere in V2 Beta in two mouths is the main reason I post this suggestion. As some of we say, it's the last chance.
It seems a little pity I can not post the suggestion earlier.
If a change hasn't been made in 10 years of alpha development, it can wait for another major release (or indefinitely).
Last edited by V2User on 28 May 2021, 06:25, edited 5 times in total.

Post Reply

Return to “AutoHotkey Development”