Code: Select all
;initial commas
Cmd, Arg1, Arg2
Cmd,, Arg2
;no initial commas
Cmd Arg1, Arg2
Cmd , Arg2
I'm curious to see what people's views are on the matter.
Code: Select all
;initial commas
Cmd, Arg1, Arg2
Cmd,, Arg2
;no initial commas
Cmd Arg1, Arg2
Cmd , Arg2
Commands has already been removed.This may change in AHK v2.
Clarifying, for anyone reading, you can omit () when calling a function without fetching the return value. The opening ( must be replaced by a space. Example,You can write functions in a command-like syntax.
Code: Select all
msgbox 1,2,3
; is the same as
msgbox(1,2,3)
; but this is not a function call,
ret := msgbox 1,2,3
What issue?This issue also relates to control flow statements and directives.
jeeswg wrote:I coined the phrase 'initial comma'
Code: Select all
Add(2, 3)
Add 2, 3 ; Parentheses can be omitted if used at the start of a line.
Code: Select all
Add,2, 3 ; ?
Code: Select all
;no initial comma
Cmd(2, 3)
Cmd 2, 3
Cmd , 3 ;is that Cmd(3) or Cmd(,3)?
;initial comma
Cmd(2, 3)
Cmd, 2, 3
Cmd,, 3
We're talking about AHK here.jeeswg wrote:I would be interested to hear what happens in other programming languages for comparison.
- A separate question: should the developer(s) be in charge of AutoHotkey, or should there be some unworkable bureaucratic dreary committee system?Let the developer(s) decide.
- A separate question: should we remove commands completely?Completely remove the command-style syntax exept control-flow commands.
- Most of the syntax choices are made in the context of programming languages that the developers and users have experienced.We're talking about AHK here.
I don't think up-to-date languages are a good comparison for AHK.just me wrote:I don't know any up-to-date language using an optional/meaningless comma after the name of a command.
Before any of these changes were made, I had been intending to start a post on commands and commas, a poll possibly. I wanted to establish some default settings for my script converters, and this would include how initial commas were to be treated. Also, I wanted to enquire as to what the standards should be in the help file, should one or other of the initial comma styles always be used, and since the help file was inconsistent, doing a poll could help suggest the best course of action.(As for requiring, allowing or not allowing the comma, I had deferred thinking about it as I was losing interest and approaching the end of the weekend. It is in my notes to revisit.)
[Forcing no initial commas is not mentioned here AFAICS.]
Removed legacy command syntax and %expression% substitution in strings.
That is, a "command" is now just a function or method call which sits at the start of the line, lacks parentheses and discards its return value.
The whole context isjeeswg wrote:(As for requiring, allowing or not allowing the comma, I had deferred thinking about it as I was losing interest and approaching the end of the weekend. It is in my notes to revisit.)
It's not related to commands in general.Parse, Read, etc. are not parameters any more than Loop or in are parameters. There is dubious benefit to requiring quote marks or allowing variables/expressions for the sub-command. (As for requiring, allowing or not allowing the comma, I had deferred thinking about it as I was losing interest and approaching the end of the weekend. It is in my notes to revisit.)
or shorterThat is, a "command" is now just a function or method call which sits at the start of the line, lacks parentheses and discards its return value.
clearly meansA "command" is now just a function or method call which lacks parentheses.
Code: Select all
Function(Param1, Param2, Param3)
Code: Select all
Function Param1, Param2, Param3
I think this is key. It is a function name, not a command, commands are gone, there shouldn't be any talk about commands. New users (and old) should learn to use functions. If a comma is to be allowed immediately after the function name, it should mean the first parameter was omitted. My speculative guess is that the space is required in order to not confuse those who are used to the command syntax. Or maybe it made the implementation simpler. Again,An optional comma was never allowed after a function name.
I don't think initial commas are either useful or confusing for the directives.helgef wrote:Although function calls without () are sometimes convenient, I wonder if there is going to be too much confusion.
agreed. When lexikos wants opinions, he usually asks before implementing it and puts out a test versionjust me wrote:The decision has already been made with v2.0-a079-be5df98. So what do you want to achieve with this poll? Shall every change be a matter of discussion because "I'm used to do ..."? What would be the advantage of an optional comma?
good point, this is ambgiousHelgef wrote:Do you mean msgbox,1,2 should be the same as msgbox ,1,2? That is, both meaning msgbox(,1,2).
Return to “AutoHotkey Development”
Users browsing this forum: OpalMonkey and 65 guests