Loop: one short variable for all Loop modes

Propose new features and changes
shorty

Loop: one short variable for all Loop modes

10 Dec 2016, 08:44

Loop (parse a string) has the variable A_LoopField
Loop (read file contents) has A_LoopReadLine
Loop (files & folders) has A_LoopFileName among other variables

Request: add one short named variable for all three Loop modes. I suggest A_L or A_Loop .

The variable would have the same content as A_LoopField or A_LoopReadLine or A_LoopFileName depending on what loop it is invoked under.

Advantage: shorter code, less typing and the user won't have to memorize both A_LoopField and A_LoopReadLine terms.
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Loop: one short variable for all Loop modes

10 Dec 2016, 10:51

Disadvantage:
If there is one loop in another you need to store the Content of the variable actually creating more issues than solving.
Since A_LoopReadLine and A_LoopField are commonly used together I am against it.
( And you didn't completely tell us your plans for Loop (Files and Folders) )
Recommends AHK Studio
User avatar
Flipeador
Posts: 1204
Joined: 15 Nov 2014, 21:31
Location: Argentina
Contact:

Re: Loop: one short variable for all Loop modes

10 Dec 2016, 11:35

i don't like it.
1) If you wish less code (this is, less size), just use c++...
2) You don't need to memorize this, just use an editor, as SciTE, and type A_Loop...
3) as nnnik said, are commonly used together.
shorty

Re: Loop: one short variable for all Loop modes

10 Dec 2016, 12:23

nnnik wrote:Disadvantage: If there is one loop in another you need to store the Content of the variable
That is already the case for nested loops of the same kind. For example two Loop (parse a string) or two Loop (read file contents) has A_LoopReadLine. I should clarify that I request A_Loop only as a complement. Many uses of Loop are not nested and there A_Loop helps. Everyone would still be free to use existing Loop variables in cases where there are nested Loops of different kinds.
nnnik wrote:you didn't completely tell us your plans for Loop (Files and Folders)
The suggestion was that A_Loop there would mirror the content of A_LoopFileName . My huch was that is the most commonly used variable. But if for example A_LoopFileFullPath is likely more commonly used by AHK users then I'd suggest that instead.
guest3456
Posts: 3462
Joined: 09 Oct 2013, 10:31

Re: Loop: one short variable for all Loop modes

10 Dec 2016, 15:59

i would rather just see A_LoopField re-used in those other contexts instead of creating a new A_Loop variable since i think its more descriptive

so in Loop, Parse, then obviously A_LoopField already exists.

but in Loop, Files, then A_LoopField would = A_LoopFileName, etc

but i dont really care

shorty

Re: Loop: one short variable for all Loop modes

10 Dec 2016, 19:20

guest3456 wrote:i would rather just see A_LoopField re-used in those other contexts instead of creating a new A_Loop variable since i think its more descriptive
From the POV of a new user what is more descriptive with the extra "Field" part? Isn't it pretty straight forward to have the variable "A_Loop", where the "A_" part is AHK's standard prefix and "Loop" reflects the command name?
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Loop: one short variable for all Loop modes

12 Dec 2016, 02:55

Why should A_Loop not be in the Loop command itself? Loop only holds A_Index - should we change A_Index into A_Loop within standard Loop, but then retain A_Index in the other Loop variants?

I understand (to some extent) the confusion on A_LoopReadLine vs A_LoopField. While the A_LoopLine variable isn't a built in one, I catch myself trying to use it instead of A_LoopReadLine. (The other way to go to "be consistent" in my mind would be to use A_LoopParseField instead of A_LoopField.) That would be the extent of any suggestion I make on changing up loop names. I agree with the point that merging now-different variables into one would cause complications / more work. I would like them kept distinct.
shorty

Re: Loop: one short variable for all Loop modes

12 Dec 2016, 17:14

Exaskryz wrote:Why should A_Loop not be in the Loop command itself? Loop only holds A_Index - should we change A_Index into A_Loop within standard Loop, but then retain A_Index in the other Loop variants?
The Loop (normal) command doesn't so to speak loop over something (substrings in a string, lines in a file or a files/folders from a filepattern) so there is nothing for A_Loop to contain in that Loop context.

A_Index is what it says it is and perfect the way it is - no need to mess with that. :D
Exaskryz wrote:merging now-different variables into one would cause complications / more work. I would like them kept distinct.
Once more: I request A_Loop only as a complement. This means there would still be A_LoopReadLine and A_LoopField , to ensure backwards compatibility for one thing, but there would also be the new short and handy A_Loop.

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 24 guests