Change the name of 'While' to 'When'

Sometimes it seems that no matter how deep I go with km, the programming is bulletproof. I'm always in awe of it. But also, I sometimes find myself wondering - and this is in no way a criticism but rather, a way to make km even more spectacular - can the translation from brilliant programming to Mr. & Mrs. Everyday User be adjusted here or there.

The questions I posed in my Question about Conditionals post - frankly, were questions I knew the answers to (with one exception). It doesn't take very long to do a simple test with Display Text In a Window, for example, to discover, for that particular action, pressing versus not pressing the OK button doesn't impact the progression of the macro.

It seems to me, there are a lot of talented people on this Forum, people who may or may not be professional programmers but are definitely passionate about learning programmers. Maybe I'm off base here but in my experience, Mr. and Mr.s Everyday Joe who have busy lives, often just want to turn on the TV, the computer, the microwave and air conditioner and want everything to be easy and to work. They may not be as passionate about programming as we are.

Maybe the developer of KM just wants to target a population of users who know just enough programming to be dangerous. (just kidding). What I'm trying to say is, I personally don't see why KM can't be used by programmers as well as Mr. Everyday Joe who wants to open Microsoft Word, open a new doc and write a letter without fiddling with coding and such. And with KM, just want to use it here or there, to quickly automate one or another repetitious task and then, move on.

Peter's response to my question about the While action confirmed my understanding of that action - but I had to work with it, in order to get it. (I previously worked with km for some decades, years ago, but then, took a long hiatus. When I returned to it, and saw all this new material, I was excited to jump in again). When I initially saw the 'While' action, like I say in the post, I assumed, the action had something to do with the word 'While' and it was associated with conditions. I figured, it probably executes while certain conditions are present. But when I used it, I discovered, it did no such thing. As Peter explained:

(Clint: If the key was pressed for a tenth of a second [if the condition was present], I figured, my actions would execute for 1/10th of a second. Then, they would stop.)

Peter: No. All the actions will execute, or none of them. Once they are executing, they will all execute to the end. Only then will the condition be evaluated the next time. Similarly, if the condition is false to start with, none of the actions will ever execute, and the macro will continue on after the while action. Only if the while action is itself executed again while the condition be reevaluated and the actions possibly executed.

Based upon my understanding thus far, nothing in the 'While' action occurs while the conditions are present. This may seem like a trivial point but I personally believe it's important.

Part of why programs like MS Word become as big as they are is because they take great care with the underlying programming and they take great care when that programming is translated into a language that Mr. and Mrs. Everyday Joe can understand.

Unless I'm missing something, While is triggered When the condition is present and if the conditions aren't present, the macro bypasses that action. When. Not while.

When you make great suggestions like this why I'll support you.

“While” is not “triggered” any time.

There is no sense in arguing terminology if you are not going to use appropriate terminology.

The “While” action is executed, and when executed, it has a specific behaviour. Namely:

  • It evaluates the condition.
  • If the condition is false, then it completes, and execution continues from the action after the While action.
  • Otherwise (condition true case), it executes the contained actions. All of them.
  • Then it starts again.

In other words, while the continue continues to be evaluated as true, it executes the actions.

This is the same as just about every other programming language, visual or otherwise. And they pretty much all use the same terminology, pioneered in the 1960s by Dijkstra and others.

It does not execute the actions when the condition is true, because that would imply that it somehow waited in the background to leap out “when” the condition is true and execute the actions. Nor would “when” imply any kind of looping, which “while” does.

And regardless, it is the defined terminology across pretty much all programming.

4 Likes