A_LoopParse (as alias for A_LoopField)

Propose new features and changes
neogna2
Posts: 590
Joined: 15 Sep 2016, 15:44

A_LoopParse (as alias for A_LoopField)

Post by neogna2 » 20 Mar 2021, 11:31

Add A_LoopParse as an alias for A_LoopField in Loop (parse a string), to better fit the pattern of other A_Loop names. Compare these

Loop, Files, FilePattern , Mode
A_LoopFileName
A_LoopFileFullPath

Loop, Read, InputFile , OutputFile
A_LoopReadLine

Loop, Reg, KeyName , Mode
A_LoopRegName
A_LoopRegType

Loop, Parse, InputVar , Delimiters, OmitChars
A_LoopField

I think A_LoopParse would be more memorable. It would also show up for the search term "parse" in AutoHotkey.chm and similar third party scripts for variable/command/function quick lookup.

Yes, this is a quite small request in the grand scope of things.
User avatar
boiler
Posts: 16931
Joined: 21 Dec 2014, 02:44

Re: A_LoopParse (as alias for A_LoopField)

Post by boiler » 22 Mar 2021, 21:26

Your proposed name is not analogous to the other examples and wouldn’t make sense because a “parse” isn’t a thing that results from the parsing loop. A “field” is a thing that results from it. It’s current name (A_LoopField) is analogous to the other examples you gave. The variable name describes what it contains. The other items contain a file name, a file path, a line that was read, etc. This one contains a field, not a parse.
neogna2
Posts: 590
Joined: 15 Sep 2016, 15:44

Re: A_LoopParse (as alias for A_LoopField)

Post by neogna2 » 23 Mar 2021, 04:25

boiler wrote:
22 Mar 2021, 21:26
Your proposed name is not analogous to the other examples because a “parse” isn’t a thing that results from the parsing loop.
That's a good point. But I'd then say that the general pattern for the other loops is A_Loop<loop type><value type>. A_LoopField has the <value type> pattern, A_LoopParse has <loop type>. Score 1-1, a draw, in the sport of analogy. The most analogous name would then instead be A_LoopParseField or A_LoopParseString or A_LoopParseSubstring.

Keep in mind that the Loop (parse a string) page already use the terms string and substring, even to explain the term field.
The built-in variable A_LoopField exists within any parsing loop. It contains the contents of the current substring (field) from InputVar.
It also looks like field is not used as a term for strings or substrings elsewhere in the documentation except when referring back to parsing Loops. I might have missed some such case though, but at the very least substring is more often used as a term for parts of a string.

My second, separate argument still holds. Both A_LoopParse and the other A_LoopParse... variants above would match for search term "parse" in AutoHotkey.chm, which is an improvement compared to A_LoopField.
Post Reply

Return to “Wish List”