Commands vs Functions

Discuss the future of the AutoHotkey language
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Commands vs Functions

28 Aug 2016, 07:51

guest3456 wrote: all functions and all commands are now interchangable, both ways,
This way too?

Code: Select all

HelloWorldMsg(Abbott, Costello)
return

HelloWorldMsg, one, two
{
   MsgBox("Hello World from %one% and %two%")
}
guest3456
Posts: 3462
Joined: 09 Oct 2013, 10:31

Re: Commands vs Functions

28 Aug 2016, 07:54

Helgef wrote:
guest3456 wrote: all functions and all commands are now interchangable, both ways,
This way too?

Code: Select all

HelloWorldMsg(Abbott, Costello)
return

HelloWorldMsg, one, two
{
   MsgBox("Hello World from %one% and %two%")
}
of course you're just wasting thread space being facetious, when you could just test it yourself

but no, sorry, i should have been more specific.

"CALLING commands and functions are interchangeable"

that just makes no sense, thats why i didn't even consider it. which is even another reason why commands should be deprecated

Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Commands vs Functions

28 Aug 2016, 08:22

Saving some space here:
Spoiler
coffee
Posts: 133
Joined: 01 Apr 2017, 07:55

Re: Commands vs Functions

01 Apr 2017, 08:17

People keep saying that command syntax is easier for newbies, but what makes autohotkey easier to use is the fact that it doesnt require a full on development suite, it can run scripts with a double click, and it exposes a lot of automating functions and functions from the operating system into simple lines. Its the accessibility to doing things that makes it great, not its obsolete command syntax. What would all of the previously mentioned take, plus reading the winapi documentation, then creating the code in say c++, you could grab the autohotkey.exe, create a ahk then type FileExist(file) and doubleclick.

My view, commands could stay, but they should follow expression syntax, no more forcing them. Use quotes for strings and no quotes for variable names, but can keep the same format as in -> command, "string", "string", variable - instead of command, string, string, %variable%. Making them a direct alias to functions, as in command("string", "string", variable), being completely interchangeable and consistent, not only with its own syntax, but also with the syntax of every other scripting/programming language out there, being a good facilitator language to even more capable ones. Instead of the clusterfuck it currently is, that just causes more confusion for no reason, when people keep using unquoted strings in expressions and get no result. It's easy to say commands are easier for new users, when expressions get demonized.

That way you consolidate what variables are, what strings are, allows you to maintain a unified consistent documentation and get up to par with times. Not sure why commands keep following some syntax that chris created 14 years ago, that no other scripting or programming language uses. No one who is getting into ahk will tell you that "string" and variable is harder than string and %variable%, or that command("string") is harder than command, "string". It's usually the people reluctant to change that oppose it, for no logical reason, in the same sense they would oppose using another direct subtitute of <insert favorite product brand>.

AHK v2 should be full expressions with all commands using expressions, since its obvious commands are not going anywhere. Ever since the project started it was my understanding that ahk v2 was the modernization of ahk, hence why it was going to break backwards compatibility. Or at least have a directive that is set by default and makes all commands use expressions, instead of having to force them with %. In all fairness, if someone swears by command syntax %variable% and string, they should stay with AHK v1 because obviously they do not require the capabilities AHK v2 could offer. In this dawn and age, even the run o' the mill office noob is probably using excel macros with VB, or powershell scripts for their computer, and guess what, these two use expression syntax. At this point, expression syntax is more widely known than the not-used-anywhere-else ahk command syntax with its backward way of doing variables and strings.
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Commands vs Functions

22 Apr 2017, 04:50

coffee wrote:Not sure why commands keep following some syntax that chris created 14 years ago, that no other scripting or programming language uses.
TAC109 wrote:A little history. AHK started as a fork of AutoIt v2 back in the day. As far as I can make out AutoIt was designed to have similar syntax to DOS, presumably to make it easy for the language to be picked up by someone who was familiar with DOS. Thus we have command-type statements, non-quoted literals and references to environmental variables enclosed by % signs; all very familiar to someone who has used DOS.
:arrow: AutoIt and Developer History

I strongly doubt that those 'non-programmers / noobs' for which the command.com syntax shall remain are familar with the DOS syntax these days. So how would they benefit?

Keep commands, if unavoidable, but not the 'command syntax'.

Return to “AutoHotkey Development”

Who is online

Users browsing this forum: No registered users and 23 guests