M2
M2 copied to clipboard
minor: nicer syntax to access hash table entries where the key is a string?
trafficstars
For a symbol k as a key in a HashTable x there is the shortcut
x.k -- the same as x#(global k)
However, since the result of (global k) may change, a programmer usually intents something like
x#"key" = someValue
Is it possible to introduce in M2 a nicer syntax for x#"key" which for example omits the quotation marks
or is there no way?
There is currently no way, but your remark is a good one. Another disadvantage of x.k is that then the symbol k gets created and shows up in the dictionary, leading to complaints about the lack of documentation for it.