[wish] Wish delete = for comparing strings
[wish] Wish delete = for comparing strings
@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 =.
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.
Re: [wish] Wish delete = for comparing strings
Most work in coding does not stem from typing an extra : before =.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.
Recommends AHK Studio
Re: [wish] Wish delete = for comparing strings
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.
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.
Re: [wish] Wish delete = for comparing strings
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.Most work in coding does not stem from typing an extra : before =.
-
- Posts: 63
- Joined: 02 Jul 2020, 11:55
Re: [wish] Wish delete = for comparing strings
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.
Re: [wish] Wish delete = for comparing strings
ure two months too late making this thread
Re: [wish] Wish delete = for comparing strings
@swagfag
I don't think it's too late.
People usually become conservative and cautious after the beta version, not now.
I don't think it's too late.
People usually become conservative and cautious after the beta version, not now.
Re: [wish] Wish delete = for comparing strings
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.
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.
Re: [wish] Wish delete = for comparing strings
@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)
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)
Re: [wish] Wish delete = for comparing strings
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.
Re: [wish] Wish delete = for comparing strings
:= 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.
= 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.
- vvhitevvizard
- Posts: 454
- Joined: 25 Nov 2018, 10:15
- Location: Russia
Re: [wish] Wish delete = for comparing strings
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.
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.
Re: [wish] Wish delete = for comparing strings
"0" = 0 is what intends to abandon and == can be just remained what it was as before.iseahound wrote: ↑26 May 2021, 23:48Now 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.
Re: [wish] Wish delete = for comparing strings
I say: Save the walrus! := Save the quirk!
Re: [wish] Wish delete = for comparing strings
@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.
Last edited by V2User on 28 May 2021, 09:20, edited 9 times in total.
Re: [wish] Wish delete = for comparing strings
Nothing wrong. This is what I totally agree.vvhitevvizard wrote: ↑27 May 2021, 04:08PS: == vs =: comparison vs assignment use frequency is like 20 vs 80.
Re: [wish] Wish delete = for comparing strings
@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...
I mean, it's against the forum rules - and it is just not a good look while you are arguing for a poll...
Re: [wish] Wish delete = for comparing strings
Yes, but the fact remains that x = x + 1 is a mathematically impossible statement, and everyone learns math.
Re: [wish] Wish delete = for comparing strings
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.
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.vvhitevvizard wrote: ↑27 May 2021, 04:08This issue keeps coming up and the majority would vote for = instead of :=. There r not so many Pascal's syntax admirers.
Re: [wish] Wish delete = for comparing strings
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.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...
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.