Suggestion: KM could have "reserved words that users cannot use as variable names"

Suggestion: KM could have "reserved words that users cannot use as variable names" so that users won't as easily confuse tokens with variables. The list of reserved variable names would be the same as the list of tokens:

https://wiki.keyboardmaestro.com/Tokens

Using one of these names as a variable could bring up a unique error message, something like:

You are using a reserved variable name which may mean you are misusing a token. Please refer to the tokens page on the km wiki for clarification.

I can't see any reason why anyone should want to use a variable with the same name as a built-in token. It's an accident waiting to happen.

I realize that 80% of my ideas never make the cut, but this idea is closer to the cut line that some of my ideas.

Hey @Sleepy,

I'd much rather see Peter remove the ability to abbreviate the variable text token to:

%yourVariableName%

Good variable reference hygiene is to always use the long form of token:

%Variable%yourVariableName%

So a text token would always be of the form:

%TextTokenName%

When presented in this fashion they are impossible to confuse.

-Chris

1 Like

Good point. I suppose both your approach and my approach could potentially break some existing macros. So it may never happen.

1 Like

It would be ok if KM had a search and replace function for variables, but until then, I can imagine it being a bit of a headache.