The Dictionary operator
This explicitly converts a String to a Dictionary. That used to be important, but the introduction of typed local variables makes these unnecessary in many cases.
The preferred usage is for declaring Dictionaries is using {… }
rather than the previous dictionary() operator. Thus:
var:dictionary vDict = {English:I; Latin: ego};
replaces both these existing methods—though they still work (the quoted string version already bing deprecated):
var:dictionary vDict="English:I; Latin: ego";
var:dictionary vDict=dictionary("English:I; Latin: ego");
Nested Lists in Dictionaries
The square-bracket List declaration can be used to define multi-item key values
var:dictionary vDict = {Apple:[red;green];Lemon:yellow};
Calling Dictionary keys
By preference, dictionary keys should not be quoted though for legacy reasons either form will still work:
$MyDictionary = {Latin: "ego"; English: "I"};
// Preferred form
$MyValue = $MyDictionary[Latin];
// and not
$MyValue = $MyDictionary["Latin"];
// though *both* forms work is only for legacy support
The Order Of [Dictionary].keys
Tinderbox dictionaries currently depend on AppKit’s NSDictionary, which appears to use a hash to order its keys. So, the (number) order is arbitrary, i.e. calling a value using $MyDictionary[N]
is not recommended.
See also—notes linking to here: