[wish] Wish delete = for comparing strings

Discuss the future of the AutoHotkey language
lexikos
Posts: 9780
Joined: 30 Sep 2013, 04:07
Contact:

Re: [wish] Wish delete = for comparing strings

Post by lexikos » 27 May 2021, 23:18

SOTE wrote:
27 May 2021, 20:25
Probably it was originally decided to use := for assignment in AutoHotkey for clarity,
I doubt it.

= acts as assignment in v1 when it follows a multi-statement comma within an expression, and in variable declarations and function parameter definitions.

= was used for literal assignment before expressions were implemented. Changing it to expression assignment would have required breaking most existing scripts at the time.

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

Re: [wish] Wish delete = for comparing strings

Post by vvhitevvizard » 28 May 2021, 01:28

SOTE wrote:
27 May 2021, 20:25
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++.
In Go and Python = is used as an ordinary assignment operator, := has a special meaning (e.g. its a declaration+initialization in Go).

And, well, there r like 500-600 languages (including the most popular ones) that actually use = as an assignment. :D

User avatar
gregster
Posts: 9224
Joined: 30 Sep 2013, 06:48

Re: [wish] Wish delete = for comparing strings

Post by gregster » 28 May 2021, 01:35

V2User wrote:
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 earlier.
You might have misunderstood me. I wasn't asking if you have more than one account - I know that already. I was asking for the reason.

Edit:After a brief discussion with the user, we decided to close V2User's alternate account. They will keep 'V2User'.

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

Re: [wish] Wish delete = for comparing strings

Post by vvhitevvizard » 28 May 2021, 02:03

SOTE wrote:
27 May 2021, 20:25
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.
...
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.
Simply put, the trend is to reduce the amount of repetitive typing. Look at Python and Go success.

Concerning copying C... Over the last 50 years, C-like style has influenced almost every programming language, basic-like and pascal-like syntax languages became the most disliked ones.

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

Re: [wish] Wish delete = for comparing strings

Post by SOTE » 28 May 2021, 02:34

vvhitevvizard wrote:
28 May 2021, 02:03
Concerning copying C... Over the last 50 years, C-like style has influenced almost every programming language, basic-like and pascal-like syntax languages became the most disliked ones.
C, C++, C#, and Java owe a tremendous amount of their popularity to their corporate sponsors and pushers. Partially why people think they should "love" those languages so is the advertising and media they got, and then it being pushed on them in corporate spaces (use X or no job in this office). C/C++ comes out of AT&T (who were one of the largest companies in the world at the time). AT&T then used C in their Unix, then pushed that to the colleges for many years, where C and Unix caught on. C# was pushed by Microsoft. Java (and the massive hype job) was pushed by Sun, Oracle, and somewhat by Google. Other programming languages didn't get that kind of corporate push and media hype.

A lot of the "dislike" for the syntax of other programming languages was artificially manufactured in the media (literally dubious published papers and negative news articles) by companies pushing their particular C family language. The point was to destroy or hurt the competition through media hype (pushing how their language is the greatest ever) and negative propaganda (how their language is better then X) when possible. A lot of language creators felt/feel forced to use C-like syntax because of seeking corporate or mainstream approval (JavaScript for example). C++ literally rode on the back of C. The corporate sponsors behind C# and Java hoped to entice C/C++ programmers to use their language by making it look familiar and to more rapidly get corporate approval. That's not a matter of the technical, that's business decisions or hoping to get attention.

Even so, BASIC-like and Pascal-like syntax is all over the place, and quite easy to find for those that bother to look. Those competing syntaxes are not going anywhere, because not everybody is invested in corporate hype and there are personal or technical advantages to using alternatives.

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

Re: [wish] Wish delete = for comparing strings

Post by vvhitevvizard » 28 May 2021, 02:52

basic/pascal WAS all over the place. Not anymore.
U r correct about business criteria in addition to technical criteria like whether something is or is not good at syntax design/run time performance/etc. B.Stroustrup in his "C++ FAQ" covered that alot.
Anyways, C family has insanely huge installed base - that's a matter of fact.

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

Re: [wish] Wish delete = for comparing strings

Post by SOTE » 28 May 2021, 03:26

vvhitevvizard wrote:
28 May 2021, 02:52
basic/pascal WAS all over the place. Not anymore.
Again, that's if you are looking...

Pascal-like syntax... Delphi (often ranks near or above Go, Ruby, and Swift), Oxygene (sold commercially), Modern Pascal (sold commercially), Smart Pascal (sold commercially), Free Pascal, PascalABC (makes .NET programs), DWScript, PL/SQL (Oracle), PLC Structured Text (Programmable Logic Controllers), Ada (used by the military and aerospace industries) etc...

BASIC-like syntax... VBScript, VBA, VB.NET (also used in UiPath/RPA), PureBasic, PowerBasic, FreeBasic, Gambas, B4X (commercially sold variants), etc... Check Wiki, and get overwhelmed. Visual Basic is still within the top 10 of the TIOBE rankings.

As mentioned, these long list of BASIC-like and Pascal-like dialects are not going anywhere, plus they have IDEs/Compilers that are not free and are being sold too. Which means that if the companies selling them can stay in business, there is a demand. Just talking about the PLC market by itself is a huge business. Of course if a person is not looking and has bias, then one may overlook them, but because a person doesn't see (or want to see them) doesn't mean they aren't there.

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

Re: [wish] Wish delete = for comparing strings

Post by lexikos » 28 May 2021, 04:53

IMO, the previous discussion from nearly 15 years ago was and is much more interesting and relevant than the discussion in this topic so far. I read through the entire topic when I started v2 (which was easier before the forum software changes that inserted numerous formatting errors), and came to the certain conclusion that it was best to keep := for assignment and = for comparison (but remove the special cases where = is assignment). Nothing that I have read or experienced since then has caused me to doubt that decision.

I really don't care which assignment operator other languages use. I personally spend a lot of time in C++, and before that I spent a lot of time with C# and UnrealScript, and before that VB. I also deal with VBScript, Lua and JavaScript occasionally. The assignment operator is = in all of these languages, yet I haven't found and don't find := to be a problem, and do not sympathize with any of the objections to it. Actually, I occasionally catch myself using := for assignment or = for comparison in C++.

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

Re: [wish] Wish delete = for comparing strings

Post by SOTE » 28 May 2021, 05:21

lexikos wrote:
28 May 2021, 04:53
IMO, the previous discussion from nearly 15 years ago was and is much more interesting and relevant than the discussion in this topic so far. I read through the entire topic when I started v2 (which was easier before the forum software changes that inserted numerous formatting errors), and came to the certain conclusion that it was best to keep := for assignment and = for comparison (but remove the special cases where = is assignment). Nothing that I have read or experienced since then has caused me to doubt that decision.
Very interesting and enlightening. Thanks for the link and providing more history about this.

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

Re: [wish] Wish delete = for comparing strings

Post by vvhitevvizard » 28 May 2021, 05:38

SOTE wrote:
28 May 2021, 03:26
As mentioned, these long list of BASIC-like and Pascal-like dialects are not going anywhere.
It doesn't matter how many basic or pascal variants exist. It won't make them more popular even combined. U've mentioned "TIOBE ranking". It lists C as top1 and Python as top2, followed by Java, C++, C#.
There r other ratings, e.g. Rosetta compares languages by number of users - And basic/pascal family loses like 3 to 1:
http://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_number_of_users

Anyways, AHK v2 being a scripting language should be compared to Python and Javascript leaders' syntax.
lexikos wrote:
28 May 2021, 04:53
I really don't care which assignment operator other languages use. I personally spend a lot of time in C++, and before that I spent a lot of time with C# and UnrealScript, and before that VB. I also deal with VBScript, Lua and JavaScript occasionally. The assignment operator is = in all of these languages, yet I haven't found and don't find := to be a problem, and do not sympathize with any of the objections to it. Actually, I occasionally catch myself using := for assignment or = for comparison in C++.
Fair enuf. Thank u for letting us gain an insight into it!
Yet doing less search/replace routine while converting from python/javascript/suchlike to ahk v2 isn't a bad thing. It's not a matter of life and death of course - there r other remaining sharp corners to be polished off. :D

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

Re: [wish] Wish delete = for comparing strings

Post by V2User » 28 May 2021, 07:57

Appreciate it very much that you shared the link.
lexikos wrote:
28 May 2021, 04:53
yet I haven't found and don't find := to be a problem, and do not sympathize with any of the objections to it.
Perhaps there is one thing we need to realize: Someone maybe could not well judge or feel one thing(:= vs =) is better or worse if he has gotten used to and relied on it for a long time. But some others who are new to that thing can truly feel which is better.
Last edited by V2User on 28 May 2021, 11:04, edited 4 times in total.

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

Re: [wish] Wish delete = for comparing strings

Post by V2User » 28 May 2021, 08:32

lexikos wrote:
27 May 2021, 23:18
= was used for literal assignment before expressions were implemented. Changing it to expression assignment would have required breaking most existing scripts at the time.
If you concern V1 scripts, most existing of them have been truly and deeply broken when changing to V2. If you mean V2, it is still in alpha. Just two months ago, V2 has undergone a huge change breaking most existing V2 scripts. It just doesn't matter. We have prepared enough now and don't mind once again before beta. Perhaps currently the only thing we lack is bravery.

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

Re: [wish] Wish delete = for comparing strings

Post by iseahound » 28 May 2021, 10:14

Here are your arguments:
  • It is more popular, and AutoHotkey should be more like other languages.
  • = is easier to type.
The main benefit of making such a switch is never discussed. What is the benefit? You can say it's easier to type, but after your change everyone must use == for comparison. If you say it's more popular, then you're second-classing AutoHotkey by implying it's only a second or third language people pick up. Go to the Ask For Help forum, and it's plainly obvious people are using AutoHotkey as a first language. It may be easier for you, but to a new programmer, there's no substantial difference.

(In fact, people are still asking about = vs. := in v1, and to prevent any more confusion, it is better to just stick with :=)

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

Re: [wish] Wish delete = for comparing strings

Post by vvhitevvizard » 28 May 2021, 10:35

iseahound wrote:
28 May 2021, 10:14
The main benefit of making such a switch is never discussed.
I suspect it was one of the most frequent topics in the past. Along with command syntax removal. :D
What is the benefit? You can say it's easier to type, but after your change everyone must use == for comparison.
Analyze ur own scripts and count the occurencies of := assignment and compare it to ordinary (case-insensitive) = operator's frequency. I've done it with my scriptlets and some of them have no = operator at all and a bunch of assignments. Shortening assignment to 1-symbol long and extending 2 comparison operators does save space and editing time.
Last edited by vvhitevvizard on 28 May 2021, 10:44, edited 1 time in total.

User avatar
gregster
Posts: 9224
Joined: 30 Sep 2013, 06:48

Re: [wish] Wish delete = for comparing strings

Post by gregster » 28 May 2021, 10:42

My advice: If anyone wants to save a significant amount of time, they shouldn't read (or write in) this topic.
I feel already brave for making it this far - feels like riding a dead horse.

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

Re: [wish] Wish delete = for comparing strings

Post by SOTE » 28 May 2021, 20:25

V2User wrote:
28 May 2021, 07:57
lexikos wrote:
28 May 2021, 04:53
yet I haven't found and don't find := to be a problem, and do not sympathize with any of the objections to it.
Perhaps there is one thing we need to realize: Someone maybe could not well judge or feel one thing(:= vs =) is better or worse if he has gotten used to and relied on it for a long time. But some others who are new to that thing can truly feel which is better.
I don't see the argument that if a person is new, that they would object to := or prefer = for assignment, as being valid. A person new to programming would not be conditioned to prefer any particular direction. They are more likely to be flexible and accept what the language is giving "as is", and then use it according to their needs.

Bias for a particular operator would likely come from someone who was using a C-like language previously, then came upon AutoHotkey, and is also being too rigid to want to adjust. You must also factor in, that if the new person comes from or was exposed to say a Pascal-like language (which is still being taught in many school systems), they would likely have no objection to :=. Those coming from other non C family languages, could possibly go in any direction.

In just about any programming language that a person jumps to, there will be differences. Not just the syntax, but often in the culture surrounding it, purpose, and design philosophies. It isn't helpful to programmers trying to become polyglots (experts in multiple languages), to be excessively rigid or bias. Not saying a person can't have a preference, thus not use something, but often the rigidity would be a disadvantage. It would be something like a foreign born English speaking person complaining about how Koreans or Spaniards use certain words in their language, while in Korea or Spain. Yeah, they can do such, but almost always it wouldn't be helpful in the end.

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

Re: [wish] Wish delete = for comparing strings

Post by SOTE » 28 May 2021, 20:28

gregster wrote:
28 May 2021, 10:42
I feel already brave for making it this far - feels like riding a dead horse.
Spoiler

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

Re: [wish] Wish delete = for comparing strings

Post by lexikos » 29 May 2021, 03:13

V2User wrote:
28 May 2021, 08:32
lexikos wrote:
27 May 2021, 23:18
= was used for literal assignment before expressions were implemented. Changing it to expression assignment would have required breaking most existing scripts at the time.
If you concern V1 scripts, most existing of them have been truly and deeply broken when changing to V2.
To help you understand the point of my post, here's a short history lesson:

0.205 BETA - November 10, 2003
AutoHotkey was initially released with syntax based on AutoIt v2. AutoIt v2 did not have expressions.

1.0.00 FINAL - February 16, 2004
The first "stable" AutoHotkey release still did not have expressions.

1.0.25 - January 12, 2005
Expressions were added. At some point during the development of this release, Chris decided to use := for assigning expressions.

2.0-a001 - April 2, 2011 (UTC+10)
This is the earliest possible time that it could be said that "most existing [v1 scripts] have been truly and deeply broken when changing to V2".

My point: Changing = to expression assignment would have required breaking most existing scripts at the time (January 12, 2005). I think it's unlikely that this was seriously considered as an option, given how much emphasis Chris put on backward-compatibility the entire time he was developing AutoHotkey. If Chris had instead decided that = should assign an expression, this topic wouldn't exist, and perhaps AutoHotkey v2 would have been released on January 12, 2005.

FYI, 2005 came before 2011. :trollface:

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

Re: [wish] Wish delete = for comparing strings

Post by V2User » 05 Jun 2021, 01:27

lexikos wrote:
29 May 2021, 03:13
My point: Changing = to expression assignment would have required breaking most existing scripts at the time (January 12, 2005). I think it's unlikely that this was seriously considered as an option, given how much emphasis Chris put on backward-compatibility the entire time he was developing AutoHotkey. If Chris had instead decided that = should assign an expression, this topic wouldn't exist, and perhaps AutoHotkey v2 would have been released on January 12, 2005.

FYI, 2005 came before 2011. :trollface:
@lexikos
Literal assignment which is as the half of the assignment syntax in V1 has already been deleted, breaking most existing V1 scripts even earlier, perhaps at the time (November 10, 2003). Breaking the rest half of V1 assignment at the time (January 12, 2005) now is just similar, I think.
I wonder which AHK editor you are using now. If you are using VSCode, then I congratulate you that it's just not a hassle to have a replacement and I would have to say sorry to you for my last insistence. To adapt to the change, all you have to do is just below:
1. Put all your V1 scripts and folders in your computer into a VSCode project folder (the folder can be a Windows library which will be better with no side effects).
2. Use the VSCode search to replace := to = in all of the scripts.
image.png
image.png (166.96 KiB) Viewed 5590 times
If the replacement for V1 scripts in VSCode in your computer is finished in less than 5 seconds, you reconsider it? 😜
Note: Many users in China want fewer words for expression assignment but haven't appeared in forum, among them Including a high-producing AHK developer who is the writer of the "AutoHotKey2 Language Support"--the current unique VSCode plugin for the latest version of V2.
Last edited by V2User on 06 Jun 2021, 00:16, edited 1 time in total.

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

Re: [wish] Wish delete = for comparing strings

Post by vvhitevvizard » 05 Jun 2021, 05:49

It would require regular expressions to search and replace considering that "="/"==" comparison operators need to be replaced with "=="/"===" respectively.

Post Reply

Return to “AutoHotkey Development”