for k, v in {font-weight : "bold"}
msgbox %k% : %v% ; : bold
for k, v in {"font-weight" : "bold"}
msgbox %k% : %v% ; font-weight : bold
Is this a bug or is a string passed as a key treated as an expression when the – sign is used? The manual says double quotes are optional though.
This is invalid causing the error. so now it makes sense.
font-value := "bold"
msgbox % font-value
Result:
Line Text: font-value := “bold” Error: This line does not contain a
recognized action.
for additional notes:
for k, v in {font*weight : "bold"}
msgbox %k% : %v% ; : bold
for k, v in {10*2 : "10*2"}
msgbox %k% : %v% ; 20 : 10*2
for k, v in { 0xeeeee : "0xeeeee"}
msgbox %k% : %v% ; 978670:
Similar to the answer here, the minus sign is reserved. The shortcut also wouldn’t work when using any other operators. The reason it isn’t a bug is that it allows math, string manipulation, functions, etc. to be used in naming keys for objects. It may or may not be a design flaw, but it works as intended by the developer.
From the AutoHotkey_L documentation:
(emphasis added)
A word character typically means letters, numbers, and underscores.