Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Thoughts for v2.0


  • Please log in to reply
105 replies to this topic
Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006

Maybe I'm missing something. I'm talking about allowing pid := Run("command") and exitCode := RunWait("command") 

 

Currently in v2-alpha, "ex-commands which currently use ErrorLevel for non-error purposes" already "return a value instead" when called with function syntax.  For instance, RunWait() returns the exit code.  Run() does not return a PID because it never used ErrorLevel for that purpose.

 

Why should that matter?

 

My point was that neither one depends on the other; the whole MsgBox line of the discussion doesn't matter.

 

Also, making a function behave differently depending on which syntax was used to call it would be inconsistent and not intuitive.

 

MsgBox would not behave differently.  It would return the result and store it in A_MsgBoxResult.  Syntax is a set of rules, and one such rule defines how (or whether) the result is passed back to the caller.

 

Also, I think that your statement is too broad.  Whether any given behaviour is intuitive is subjective, and can't be generalized so easily.

 

Why should some certain functions (ex-commands) when called using command syntax have arguments that magically accept plain variable names?

 

Passing a name is the simplest and most obvious way to tell the command where to put its result.

 

Currently it's not even consistent for built-in functionality (RegExMatch requires %var%, SplitPath doesn't, etc).

 

I have already addressed that in the document for which this topic was created.  The most likely outcome is that built-in functions will get some way to specify which parameters are variables, and functions will not require % for output variables.