nnnik wrote:All your reasoning is based on explaining what StrSplit currently does.
Sure, when you conveniently ignore my second paragraph. Why are you fixated on StrSplit() anyway? You want to add complexity to it so that it can be used for "efficient" enumeration (while possibly making it less efficient in some array-access cases), but it would be more efficient and just as usable to create a separate function for enumeration. Either way it would have the issues I mentioned.
Of course there still will be overhead, however I think it is neglectable compared to the gain in consistency.
First you say that the speed-loss can be negated, now you say that the speed-loss does not matter. Hopefully that means the discussion can end.
guest3456 wrote:why dont you tell us why you even decided to "experiment" with this syntax in the first place?
Maybe because I don't like repeating myself. Why don't you show some respect?
I wrote:I added them as an obvious method of giving authors a way to use expression syntax uniformly across the entire script (avoiding commands and the % prefix), but that's been superseded. It seemed obvious because it looks like a function call. On the other hand, it looks like a function call or definition, but is neither. I decided that the original "sub-command" approach was clearer. It goes without saying that any statement beginning with "Loop " (with space) is a loop statement, whereas the same can't be said for any statement/function name beginning with "Loop" (without space).
One (perhaps contrived) drawback of the function-like syntax is that typos may go undetected:
Code: Select all
Looparse(x, y) {
; this doesn't raise an error.
}
Source: (5) Re: v2.0-a079-be5df98 - Loop statements - AutoHotkey Community
just me wrote:The word PARSE is defined as a parameter in v1. What is it in v2?
I didn't see this post earlier. Loop and Parse are both keywords, I suppose, in the same sense as in every other programming languages which has elements based on human language. In some sense Parse is an operator - it denotes an operation - but clearly it does not fall under the same category as and/or/not/new. Maybe it is a parameter, maybe not. There is no single way to classify it, and I do not see why it matters in the first place.
; Keyword, without comma
Loop Parse String, ...
Does it being a keyword preclude the use of a comma? Why?
Parameter?
This would require surrounding quotes.
Why? Goto and gosub do not require quotes. I see no practical value in taking "consistency" that far. (Though for goto/gosub, I opted for consistency with label definitions over consistency with functions.)
Sub-command?
I hope that v2 will abolish sub-commands.
Why, when it is just a matter of how you classify it, or whether there is a space? I converted WinGet/WinSet/etc. to individual functions to avoid adding quote marks (i.e. convenience and style) and to provide consistency between related functions (e.g. WinGetText vs WinGet other things), but that hardly applies to Loop in its current form.