M2 icon indicating copy to clipboard operation
M2 copied to clipboard

minor: nicer syntax to access hash table entries where the key is a string?

Open jakobkroeker opened this issue 8 years ago • 1 comments
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?

jakobkroeker avatar Mar 19 '17 14:03 jakobkroeker

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.

DanGrayson avatar Mar 19 '17 14:03 DanGrayson