why was LoopParse (no space) removed?

Discuss the future of the AutoHotkey language
guest3456
Posts: 2553
Joined: 09 Oct 2013, 10:31

Re: why was LoopParse (no space) removed?

26 Dec 2017, 07:35

just me wrote:
lexikos wrote:Does it being a keyword preclude the use of a comma? Why?
just me wrote:Keyword?
v1 docs wrote:
  • For and several types of If statement use keywords or an operator instead of commas to separate some of their parameters.
I think that's the right way to handle keywords/operators which don't define built-in commands/functions/statements.
agree. but i dont know how that would work for all of the special Loop params.


lexikos wrote:
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?
thanks for the link, i did not remember seeing that post. you arent required to repeat yourself, but you could've linked that initially in your first reply. you can't expect everyone to have read every post in every thread

re: respect.. respect is earned and reciprocated, not automatically given. you often don't show much respect to the people who make suggestions. you've been dismissive for a while now whenever most people make a request (including towards everyone in this thread at some point or another).

that said, i dont envy your position. i can imagine its not easy being the sole maintainer of a fairly large project like this. so in that regard its my bad and i should have shown more respect, and ill also take this opportunity to thank you for your continued work. but i think youve become a bit jaded, which is understandable after working on this for years and years. you even hinted at something of that effect in your anniversary post. maybe its time for you to step away and find something you're more interested in? i certainly don't want that. i'd rather you continue in your role, because who knows what happens if you leave. perhaps HotKeyIt steps up, perhaps not. but if you ever leave that puts a huge question mark on the future of AHK. but at the same time, maybe thats best for you, personally, on your journey. i don't know. Chris faced that at some point too


nnnik wrote:OK as a basis for this prove I will take AHK v1.
We assume that AHK v1 is easy to learn due to practical tests ( people that learned AHK v1 say that it is easy to learn ).
Most people that started with command syntax - therefore we can assume that this is the main aspect of "easy to learn".
AHKv2 lacks this aspect therefore we can assume also lacks the attribute "easy to learn".
so are you proposing the re-addition of command syntax? and if not, then what are you proposing to make things 'easier'?

User avatar
nnnik
Posts: 4242
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: why was LoopParse (no space) removed?

26 Dec 2017, 07:55

guest3456 wrote:so are you proposing the re-addition of command syntax? and if not, then what are you proposing to make things 'easier'?
No but I proved that AutoHotkey v2 is heading in the general direction of not being easy to learn.
Of course removing the command syntax has it's advantages. However in this case I don't think that there is a single good reason why we should keep LoopParse.
Having multiple ways to do the same thing actually makes things more confusing when learning a language.
We can use StrSplit for everything that LoopParse can and more things. It should be the standard way for splitting strings and we should establish that as good practice.
LoopParse is insignificantly faster. StrSplit is more consistent, generalized and powerful.
I suggest to remove LoopParse.
Recommends AHK Studio
guest3456
Posts: 2553
Joined: 09 Oct 2013, 10:31

Re: why was LoopParse (no space) removed?

26 Dec 2017, 08:04

nnnik wrote:
guest3456 wrote:so are you proposing the re-addition of command syntax? and if not, then what are you proposing to make things 'easier'?
No but I proved that AutoHotkey v2 is heading in the general direction of not being easy to learn.
Of course removing the command syntax has it's advantages. However in this case I don't think that there is a single good reason why we should keep LoopParse.
Having multiple ways to do the same thing actually makes things more confusing when learning a language.
v1 has 3 ways: LoopParse, and StringSplit, and StrSplit, and you claimed v1 was easier and less confusing.
nnnik wrote:We can use StrSplit for everything that LoopParse can and more things. It should be the standard way for splitting strings and we should establish that as good practice.
LoopParse is insignificantly faster. StrSplit is more consistent, generalized and powerful.
I suggest to remove LoopParse.
i disagree. splitting and parsing are two separate things

User avatar
jeeswg
Posts: 6646
Joined: 19 Dec 2016, 01:58
Location: UK

Re: why was LoopParse (no space) removed?

26 Dec 2017, 09:31

Re. Loop.
- I have found it interesting that subcommands are being removed everywhere, except for Loop. I had wanted something like 'LoopXXX' when I started using AHK v1, to avoid ambiguity (is it a count/file/reg loop).
- I view the 5 types of loop as quite different, different enough to be potentially viewed as separate control flow statements, and not 'subcommands' of Loop.
- Also, by removing the space, it's easier to jump between instances of Loop Count and ignore the next Loop File/Parse/Read/Reg, when searching text.
- When writing a beginner tutorial, I found it a bit odd trying to explain that Loop is special, that it uses subcommands but without double quotes, it reminded me of trying to explain syntax inconsistencies in AHK v1. (I think it's fine for some control flow statements/directives to use literal text, however, Loop would be using an odd mix of literal/expression parameters.)

Some general points about AHK v2.
Spoiler
Last edited by jeeswg on 08 Jul 2019, 15:07, edited 5 times in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
coffee
Posts: 111
Joined: 01 Apr 2017, 07:55

Re: why was LoopParse (no space) removed?

26 Dec 2017, 13:38

Comma sucks, in rulz

Code: Select all

Loop Files in path
Loop Files in path, "df"
Loop Files in "c:\folder\folder", "dfr"
Loop Files in "c:\folder\folder\file.ext"

Loop Parse in var, delims
Loop Parse in var, "|"
Loop Parse in "a,b,c,d,e", ","

Loop Read in filepath, outfile
Loop Read in "c:\folder\file.txt"

Loop Reg in keyname, "r"
Loop Reg in "HKLM\Software\Classes"
User avatar
nnnik
Posts: 4242
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: why was LoopParse (no space) removed?

26 Dec 2017, 15:10

guest3456 wrote:
nnnik wrote:
guest3456 wrote:so are you proposing the re-addition of command syntax? and if not, then what are you proposing to make things 'easier'?
No but I proved that AutoHotkey v2 is heading in the general direction of not being easy to learn.
Of course removing the command syntax has it's advantages. However in this case I don't think that there is a single good reason why we should keep LoopParse.
Having multiple ways to do the same thing actually makes things more confusing when learning a language.
v1 has 3 ways: LoopParse, and StringSplit, and StrSplit, and you claimed v1 was easier and less confusing.
I claimed that the command syntax was easier to learn.
I didn't claim that things were perfect or less confusing. Also you need to consider that AHKv1 grew historically and that not all StrSplit ways were available at all times.
guest3456 wrote:
nnnik wrote:We can use StrSplit for everything that LoopParse can and more things. It should be the standard way for splitting strings and we should establish that as good practice.
LoopParse is insignificantly faster. StrSplit is more consistent, generalized and powerful.
I suggest to remove LoopParse.
i disagree. splitting and parsing are two separate things
Yes they are. Loop Parse and StrSplit both split, neither parse. In the case of Loop, Parse is just a name that is easier to remember.

@jeeswg cba to correct your post
Recommends AHK Studio
User avatar
jeeswg
Posts: 6646
Joined: 19 Dec 2016, 01:58
Location: UK

Re: why was LoopParse (no space) removed?

26 Dec 2017, 16:20

- @nnnik: I wrote 4 points arguing that AHK v2 is simpler. There may also be points in favour of AHK v1 being simpler, e.g. you don't have to use double quotes for strings. It seems unlikely that you could 'correct' my post, the 4 points are valid and can't really be contradicted.
- If you want to 'win' an argument that AHK v1 is simpler then: (a) you should start a new thread, (b) you'll need a lot of arguments in favour of AHK v1 being simpler (to outweigh any arguments in favour of AHK v2), but unfortunately it is highly unlikely that you'll be able to dismantle or 'correct' any of the arguments that I made. Good luck trying.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
guest3456
Posts: 2553
Joined: 09 Oct 2013, 10:31

Re: why was LoopParse (no space) removed?

26 Dec 2017, 19:54

coffee wrote:Comma sucks, in rulz

Code: Select all

Loop Files in path
Loop Files in path, "df"
Loop Files in "c:\folder\folder", "dfr"
Loop Files in "c:\folder\folder\file.ext"

Loop Parse in var, delims
Loop Parse in var, "|"
Loop Parse in "a,b,c,d,e", ","

Loop Read in filepath, outfile
Loop Read in "c:\folder\file.txt"

Loop Reg in keyname, "r"
Loop Reg in "HKLM\Software\Classes"
hadn't seen this suggested before, but i like it the best. but also with the OneWord versions instead of the two word
Last edited by guest3456 on 26 Dec 2017, 20:27, edited 1 time in total.

lexikos
Posts: 6483
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: why was LoopParse (no space) removed?

26 Dec 2017, 20:16

just me wrote:
lexikos wrote:Does it being a keyword preclude the use of a comma? Why?
just me wrote:Keyword?
v1 docs wrote:
  • For and several types of If statement use keywords or an operator instead of commas to separate some of their parameters.
I think that's the right way to handle keywords/operators which don't define built-in commands/functions/statements.
That doesn't make any sense to me. This keyword is not being used to separate parameters.
So only "expression syntax" is left, is it?
No, nor did I say it. Directives do not use expressions (except #If). Hotkey labels and hotstrings do not use expressions.

Goto and Gosub without parentheses now accept only a naked label name, much like C. Even if they accepted %variables%, it would at least be comparable to a (dynamic) function call.
nnnik wrote:We could also let the first access of the StrSplit result define which type of thing it is:
It is still less efficient. StrSplit parses the string provided by the caller directly, and appends one string to the array for each field. Your method would need to store the whole string in the object prior to first access (meaning a memory allocation and copy of a string that could be small or very large), and then also do the same work it did before, but delayed until first access.

Loop Parse already duplicates the input string at the start, but it doesn't also have to construct two objects (the StrSplit object and enumerator) and deal with the overhead of dynamic dispatch (calling _NewEnum and Next). You can cheat and use the one object for both, but that may not go well for anyone attempting to use multiple for-loops on one object. You can design for this and allow _NewEnum to return a new object on the second and subsequent calls, but that means another small increase in code size and complexity (and there's still more runtime overhead).

Maybe the performance difference is nothing for common hotkey scripts, but it may matter when parsing large volumes of text.
I guess that the case of not accessing A_LoopField is a really rare occurence and should probably not matter much when designing a coding element.
It doesn't matter. The point was that Loop Parse makes fewer heap allocations.
nnnik wrote:Most people that started with command syntax - therefore we can assume that this is the main aspect of "easy to learn".
This is not proof, merely conjecture, and I disagree. People started with command syntax because that's what the documentation promoted, if not actually the only choice. I think coffee said it well:
coffee wrote:People keep saying that command syntax is easier for newbies, but what makes autohotkey easier to use is the fact that it doesnt require a full on development suite, it can run scripts with a double click, and it exposes a lot of automating functions and functions from the operating system into simple lines. Its the accessibility to doing things that makes it great, not its obsolete command syntax.
Source: Commands vs Functions - Page 5 - AutoHotkey Community
just me
Posts: 6464
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: why was LoopParse (no space) removed?

27 Dec 2017, 05:47

lexikos, obviously you don't want to change it, so just leave all as it is, though it doesn't make any sense to me.
Helgef
Posts: 3890
Joined: 17 Jul 2016, 01:02
Contact:

Re: why was LoopParse (no space) removed?

27 Dec 2017, 14:39

I will add to the monologues; I couldn't care less if it is loop parse or loopParse. However, I vastly prefer that the loop performs well, rather than it being consistent with I don't know what.

Cheers.
just me
Posts: 6464
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: why was LoopParse (no space) removed?

27 Dec 2017, 16:28

LoopParse might perform (some fractions of) a nanosecond better. It's not a question of performance, it's just a question of syntax design.

Cheers.
User avatar
nnnik
Posts: 4242
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: why was LoopParse (no space) removed?

28 Dec 2017, 07:05

Well all things considered I still don't understand why you want to keep LoopParse.
Could you explain why and which other reasons you have beside a minor speed gain?
Recommends AHK Studio
just me
Posts: 6464
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: why was LoopParse (no space) removed?

28 Dec 2017, 10:48

Hi nnnik,
I wrote:It's not a question of performance, it's just a question of syntax design.
Did you read the whole thread?
User avatar
nnnik
Posts: 4242
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: why was LoopParse (no space) removed?

28 Dec 2017, 11:06

just me wrote:Hi nnnik,
I wrote:It's not a question of performance, it's just a question of syntax design.
Did you read the whole thread?
Yes I have read it over again and I have not found the post that clearly points out the syntax design advantage of having both LoopParse and For each, substr in StrSplit over just having StrSplit. If you did find some could you show me?
I'd be fine with Lexikos saying "I want to stick with the procedural paradigma for AHK v2 for many situations, since AHKs objects aren't really optimized and I don't plan on doing that in the foreseeable future" - I just want some reason.
Recommends AHK Studio
guest3456
Posts: 2553
Joined: 09 Oct 2013, 10:31

Re: why was LoopParse (no space) removed?

28 Dec 2017, 15:09

nnnik wrote:If you did find some could you show me?
... I just want some reason.
some reasonings were already given here:
https://autohotkey.com/boards/viewtopic ... 18#p190618

just me
Posts: 6464
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: why was LoopParse (no space) removed?

28 Dec 2017, 17:40

Hi nnnik,

I'm talking about Loop Parse vs. LoopParse. IMO, it's a relict of an AHK 1.0 concept pretending that there is only one Loop statement performing all the different tasks depending on different parameters. Interestingly, this "one and only Loop statement performing different tasks" has been documented in different sections of the help file related to the special task as long as I remember. This is one of the reasons why I think that the 'one and only' concept has always been wrong.

In AHK v1 the 'special task' is determined by the first parameter. IMO, AHK v2 should replace this poor concept and introduce different statements for different tasks. That's why I suppose e.g. LoopParse Param1, ... instead of Loop Parse, Param1, .... That's my conception of a clear and 'easy to learn' syntax.
User avatar
jeeswg
Posts: 6646
Joined: 19 Dec 2016, 01:58
Location: UK

Re: why was LoopParse (no space) removed?

30 Dec 2017, 09:32

With a 'OneWord' option/default there would be a simple to describe situation: 7 loop-related one-word control flow statements, with parameter syntax rules similar to functions.

Code: Select all

for
Loop
LoopFiles
LoopParse
LoopRead
LoopReg
while

for
Loop
Loop Files
Loop Parse
Loop Read
Loop Reg
while
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
just me
Posts: 6464
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: why was LoopParse (no space) removed?

30 Dec 2017, 09:50

And the solution is another "which can be omitted" option. :(

@jeeswg:
The second part of your list should be

Code: Select all

For
Loop [[Count]|[Files|Parse|Read|Reg][,]]
While
There are only three control-flow statements for loops with this syntax.

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: No registered users and 10 guests