Page 2 of 2

Re: Command syntax - "This parameter can be an expression"

Posted: 18 Jan 2016, 04:13
by topsoftbe
jNizM wrote:End of Commands and more Functions would be nice

From:

Code: Select all

MsgBox % "Output: " VarOut
MsgBox 64,, % "Output: " VarOut
MsgBox 64, % "Title - " Name, % "Output: " VarOut
To:

Code: Select all

MsgBox("Output: " VarOut)
MsgBox(64,, "Output: " VarOut)
MsgBox(64, "Title - " Name, "Output: " VarOut)
I completely agree with you...In your example there is a clear distinction between text and variables, as it should be.

Re: Command syntax - "This parameter can be an expression"

Posted: 18 Jan 2016, 05:01
by just me

Code: Select all

MsgBox(64, "Title - " Name, "Output: " VarOut)
is already supported in v2 - see: Command(), or am I missing something?

Re: Command syntax - "This parameter can be an expression"

Posted: 18 Jan 2016, 05:11
by jNizM
Would not it be clearer, less confused and easier for new and beginner to learn and remember one thing like just the function syntax?
So how about remove the command syntax in v2? (e.g. MsgBox in v2)

I personal see no benefit for the command over the function syntax why we should have both.


*Sorry for my crap eng. It's hard for me to write what I think and mean.

Re: Command syntax - "This parameter can be an expression"

Posted: 18 Jan 2016, 05:22
by just me
It has been discussed already, no chance. Quite the contrary: "All functions can now be called as commands, including library functions which haven't been manually #included."

Re: Command syntax - "This parameter can be an expression"

Posted: 18 Jan 2016, 08:02
by HotKeyIt
jNizM wrote:Would not it be clearer, less confused and easier for new and beginner to learn and remember one thing like just the function syntax?
I personal see no benefit for the command over the function syntax why we should have both.
This would mean beginners need to learn expressions first before using AutoHotkey which is confusing when you are not a programmer.
Imagine below simple script would go over 1000 lines, users would need to write around 7500 more characters, even with suggested additional Gui functions you would need to write 5750 additional characters, that is just crazy.
It is like in AutoIt where you have to write $ before every variable to indicate that it is a variable, having only functions would mean to move in same direction (writing hundreds of useless characters).

Code: Select all

; Command syntax 79 characters
Gui,Add,Text,w100,Test
Gui,Add,Edit,w100,Test
Gui,Add,Button,w100,Test
Gui,Show

; Function syntax 109 characters
Gui("Add","Text","w100","Test")
Gui("Add","Edit","w100","Test")
Gui("Add","Button","w100","Test")
Gui("Show")

; Even with your shorthand functions
; 75 characters
GuiAdd,Text,w100,Test
GuiAdd,Edit,w100,Test
GuiAdd,Button,w100,Test
GuiShow

; Function syntax 98 characters
GuiAdd("Text","w100","Test")
GuiAdd("Edit","w100","Test")
GuiAdd("Button","w100","Test")
GuiShow()

Re: Command syntax - "This parameter can be an expression"

Posted: 22 Jan 2016, 11:10
by Gio
Here is how learning the syntaxes occured to me:

AHK was the first programming language i learned and i clearly remember i grasped the way commands worked long before functions. However, most of the built-in functionality at the time was in fact based on command syntax, which means i HAD to grasp commands first, so i cannot really say that learning functions first would've been harder.

Also, even though i say i understood the way commands worked first, it actually took me much much longer to undestand it enougth to be able to easily figure out if a parameter needed expression syntax or not (i.e., even if a parameter was expecting a variable, i would still try enclosing it in percent signs first, which obviously resulted in no good).

So i guess that letting function syntax be the only syntax available seems to be the most reasonable idea for simplifying the syntax and avoiding newb confusion.