At the data level, they are not compatible at all. In Panorama 6, dictionaries were text with special delimiters. In Panorama X, dictionaries are based on NSDictionary, a data structure defined by and used by Cocoa (the NS stands for NeXT Step, the original system that OS X and iOS were based on). Because of this, you can store arbitrary data in any dictionary element, for example numbers can be stored as numbers instead of text – you can even put dictionaries inside of dictionaries. This is the native dictionary structure used by Objective-C, now accessible to Panorama.
At the programming level, dictionaries in 6/X are compatible. For example functions like getdictionaryvalue(
and listdictionarykeys(
work exactly the same. But the underlying storage is different. If you pass a Panorama 6 dictionary to Panorama X it will internally convert it to the new format. But there are no functions or statements that convert the new format to the old format (and if there was, you could possibly lose data since the new dictionary format can store things that could not be stored before).
So take your example of a dictionary stored in a disk file. You probably read the dictionary in from the disk like this:
local mydict
mydict = fileload("somefile.data") // using the new one parameter fileload option, but that doesn't matter to this example
At this point, mydict
has a Panorama 6 format dictionary in it. But now lets add another value (or change an existing value):
setdictionaryvalue mydict, "Price",2.99
Now mydict
is in Panorama X format. Notice also that I have stored a number without converting the number to text. So this works.
message getdictionaryvalue(mydict,"Price")+2
No val(
function required for this calculation – getdictionaryvalue(
is returning the same exact numeric value that was put into the dictionary. It could also be floating point, or binary (which in Panorama X is not the same thing as text, because text is now unicode).
But back to the original point, even if I had added a text value, mydict
would be converted to the new format. Any statement or function that changes, adds or deletes a dictionary value will cause the dictionary to be automatically converted to the new format.
Now suppose I write this dictionary to a file:
filesave "somefile.data",mydict // again, using new simplified syntax for filesave
Now this file contains a Panorama X dictionary, and it can no longer be read by Panorama 6. (For that matter, it won’t be readable by people either – unlike the old format, the new format looks like gibberish, but Objective-C understands it.)