AHK is a *bad* language?

Discuss Autohotkey related topics here. Not a place to share code.
Forum rules
Discuss Autohotkey related topics here. Not a place to share code.
omar
Posts: 539
Joined: 22 Oct 2015, 17:56

AHK is a *bad* language?

23 May 2016, 05:49

First of all: I love AHK. It's awesome. I couldn't live without it.

The thing is, I saw a 10 min video on youtube about why PHP is sooo bad.
The guy was complaining about things like built in functions like strtoupper (or something like that) - he was saying it was a bad name, it should have capitals and other things.
Then he went on to say how you could do so many bad things you wouldn't be able to do in a 'good' programming language.

I got thinking: heck, you haven't seen the wild west that is AHK!!! If you think PHP is bad, you aint seen nothing yet!!

Am I right? Or am I just an inexperienced newbie to AHK (despite having used for years) and don't really know it well enough?

:)
grant
Posts: 323
Joined: 14 Oct 2015, 17:27

Re: AHK is a *bad* language?

23 May 2016, 06:10

.... opinion..... everyone has one.

AHK is pretty easy to learn and very fast to get something off the ground, especially when it comes to a desktop (windows) environment. That is what makes it so great in my mind and I have yet to find something that I *NEED* that it can not do.

10 minutes to make a script that saves me an hour a day. Can it be done "better" in another language? - probably. Could I have done it in another language? - maybe in a couple days, but why would I?
User avatar
Capn Odin
Posts: 1352
Joined: 23 Feb 2016, 19:45
Location: Denmark
Contact:

Re: AHK is a *bad* language?

23 May 2016, 06:11

Compared to something like Python, AutoHotkey is definitely less consistent.
My biggest problems are = as an assignment operator, if without parentheses and commands.

I do however feel that if you stick to one way of writing your scripts, it works consistently.

Edit: My complaints are likely due to my baggrund in Java, C/C++ and Python
Please excuse my spelling I am dyslexic.
User avatar
tidbit
Posts: 1272
Joined: 29 Sep 2013, 17:15
Location: USA

Re: AHK is a *bad* language?

23 May 2016, 11:10

"if without parentheses and commands."
simple solutions: always use if's with ()'s. especially when helping new people, get them in the habit awell.

also, it's as grant said. ".... opinion..... everyone has one". Some people hate features of a language, some love them. Some don't care. I could nag about python and how it sucks because it lacks {} :P but some people love that. or many languages needing ; at the end of most lines, or languages that are Case_Sensitive(), or countless other little thing that might annoy me but not other people.

offtopic: I have seen plenty of topics now that are AHK related but not a script, ask for help or a tutorial. but shouldn't go in "offtopic". I think we need a "General" AHK forum for topics like these.
until then, this is going in offtopic as it's not asking for help.
rawr. fear me.
*poke*
Is it December 21, 2012 yet?
guest3456
Posts: 3454
Joined: 09 Oct 2013, 10:31

Re: AHK is a *bad* language?

23 May 2016, 11:22

AHK syntax is gross, but it was intended for non-programmers so what do you expect

AHK v2 is more consistent and should be made the standard asap

Coco
Posts: 771
Joined: 29 Sep 2013, 20:37
Contact:

Re: AHK is a *bad* language?

24 May 2016, 13:44

Capn Odin wrote:I do however feel that if you stick to one way of writing your scripts, it works consistently.
this
tidbit wrote:simple solutions: always use if's with ()'s. especially when helping new people, get them in the habit awell.
I agree
guest3456 wrote:AHK v2 is more consistent and should be made the standard asap
+1
florisvos
Posts: 20
Joined: 15 Apr 2016, 06:26

Re: AHK is a *bad* language?

28 May 2016, 15:05

Though I never bothered to check thoroughly, it always seemed to me that for example:
In build-in functions the order of Inputvar - Outputvar - Conditions is not always the same.
The use of ""'s, %%'s, or neither is not always very clear, especially in relation to using :=, .= or just =
though just today I discovered that always using only "=" might make things easier :) But then, within functions or IF's, I still have doubts sometimes about what to do :(
User avatar
tidbit
Posts: 1272
Joined: 29 Sep 2013, 17:15
Location: USA

Re: AHK is a *bad* language?

28 May 2016, 17:11

florisvos wrote:always using only "=" might make things easier
until you need to do math or use functions or arrays or objects :P learning and using := and always (or almost always, once you understand the differences) using it will be easier.

var=func() ... is not valid, unless you want the literal text "func()"
var:=func() ... will return the value/output of func(), if any

var=5+5 ... will be the literal text "5+5"
var:=5+5 ... will result in "10"

var=5+%aaa% ... will be the literal text "5+8" if aaa contained "8"
var:=5+aaa ... will result in "13" if aaa contained "8"

and please, please oh please don't use = % it's exactly the same as := but uglier and non-standard
rawr. fear me.
*poke*
Is it December 21, 2012 yet?
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: AHK is a *bad* language?

28 May 2016, 19:09

Hehe = % "mwahaha"
msgbox % " troll says " hehe ""
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: AHK is a *bad* language?

29 May 2016, 02:11

joedf wrote:Hehe = % "mwahaha"
msgbox % " troll says """ . hehe . """"
Recommends AHK Studio
florisvos
Posts: 20
Joined: 15 Apr 2016, 06:26

Re: AHK is a *bad* language?

29 May 2016, 03:00

tidbit wrote:
florisvos wrote:always using only "=" might make things easier
until you need to do math or use functions or arrays or objects :P learning and using := and always (or almost always, once you understand the differences) using it will be easier.
Of course, of course. I was in the habbit of always using := until I wanted to make strings containing vars.

varstring .= %var1%"`n"%var2% ?
varstring := var1"`n"var2 ?

I think that doesn't work does it?

but varstring = %var1%`n%var2% does :) Or am I missing something?
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: AHK is a *bad* language?

29 May 2016, 06:08

Yeah you are indeed missing something.
It should be varstring := var1 "`n" var2 or even better:
varstring := var1 . "`n" . var2
But you are free to use whatever you like.
Recommends AHK Studio
User avatar
tidbit
Posts: 1272
Joined: 29 Sep 2013, 17:15
Location: USA

Re: AHK is a *bad* language?

29 May 2016, 10:13

varstring .= %var1%"`n"%var2% is not valid (well, not the results you probably expect).
as the tutorial states: "Any equal sign (=) with a symbol in front of it is called an Assignment Operator, which are always an expression. So := += -= .= etc. always use expressions."
so anything other than "=" uses the same format of := (that format is "expressions": no %'s and text wrapped in "quotes")

also, .= is the built-in concat thing, which joins anything to the RIGHT of .= to the variable on the LEFT of .=. so:
say var1 has "yellow".
and you do: var1.=" banana"
var1 now contains "yellow banana"


also, the issue you had with varstring := var1"`n"var2 is because in expressions, variables need a space around them. they cannot be touching the quotes. spaces outside of quotes are not literal spaces as a space is a string.
varstring := var1 "`n" var2
rawr. fear me.
*poke*
Is it December 21, 2012 yet?
florisvos
Posts: 20
Joined: 15 Apr 2016, 06:26

Re: AHK is a *bad* language?

29 May 2016, 12:29

nnnik wrote: varstring := var1 . "`n" . var2
Thanks so much! That' s the one I'll use from now on.
guest3456
Posts: 3454
Joined: 09 Oct 2013, 10:31

Re: AHK is a *bad* language?

29 May 2016, 20:45

nnnik wrote:
joedf wrote:Hehe = % "mwahaha"
msgbox % " troll says """ . hehe . """"
i too cannot stand auto concat

florisvos
Posts: 20
Joined: 15 Apr 2016, 06:26

Re: AHK is a *bad* language?

30 May 2016, 23:39

I know I'm going offtopic now but since we are talking about some useful coding practises I have a question about loops.

I only recently started learning about a_index (it's fantastic), break and continue. Is there some ultimate way of using loops that I should know of (similar to the way there are some ways of using %%'s and ""'s that seem to have advantages over others, in terms of being more consistent)?

For example, I used to have "while (1)" loops in the past but now I see that I might as well simply use "loop". And it seems that often it's better to have "loop" that gets escaped with a "break" command than making a While with some complex condition in it.
Elesar
Posts: 70
Joined: 31 Oct 2013, 07:56

Re: AHK is a *bad* language?

06 Jun 2016, 13:07

If you have a single condition that can break your loop, a while(condition) format is probably best. If you could have several different things that may need to stop your loop, you could use loop with break or stay with the while(condition). That is really up to you and how your script works.

As an alternative, if you have something that needs checking several times a second or less (instead of several thousand times a second), consider using SetTimer, Label, Delay instead, as that will trigger the label every time the delay expires, but is otherwise not tying up your script thread, so it can be doing other things (or nothing) while it waits to check the condition again.
Allos

Re: AHK is a *bad* language?

25 Jun 2016, 07:47

grant wrote: AHK is pretty easy to learn and very fast to get something off the ground, especially when it comes to a desktop (windows) environment. That is what makes it so great in my mind and I have yet to find something that I *NEED* that it can not do.

10 minutes to make a script that saves me an hour a day. Can it be done "better" in another language? - probably. Could I have done it in another language? - maybe in a couple days, but why would I?
If someone is looking for a better language which is just as fast as AHK is to get things going, check out AutoIt. I'm just a user, not anyone part of the project. It's exactly the same feature-wise as AHK, as far as I can tell, but with an actually consistent language, which means I don't have to check the tutorials/references every time I want to script something (very useful for making something in only 10 mins).
QuadrupleA

Re: AHK is a *bad* language?

07 Nov 2016, 21:03

Just wanted to chime in - as a veteran programmer who writes stuff in Python, C/C++, C#, VB, LISP, assembler, SQL, javascript, etc. I find the AutoHotKey syntax absolutely atrocious. It confuses me to no end. Really wish the project would adopt a modern syntax that is consistent and has one clear meaning. Put strings in quotes, make unquoted stuff represent identifiers, require parenthesis for function calls instead of this weird FuncName, Val1, Val2 nonsense, etc.

Programming is hard, and having a language that's so ambiguous and bizarre just makes it harder for everyone, including the non-programmers all this nonsense was seemingly intended to make it easy for.

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 17 guests