Mixing types in Property Lists

Date:    Tue, 14 Nov 1995 09:42:44 GMT
From:    Andreas Viviani <aviviani@ACCESS.CH>
Much of the confusion comes from the really fine flexibility of lists. Summarized, there are 3 types of properties possible: If you know exactly what is the difference between a symbol and a string (this is not within my scope), and are aware that any string declared as a property in a list is also represented by a symbol, and any number property can be found too with symbols or strings, and strings are case sensitive but not symbols, then all actions are transparent and quite flexible.

For the undocumented art of property extraction like

  put the property of anyList

you have to remind clearly that "property" is used as a symbol, despite the "#" is missing.

Now -- I really do not want to confuse you more, but I will show all the possibilities -- you can even mix property types in one list. And I do it just now to show all the possibilities to extract from such a list, nearly without comments, except that "<Void>" means that nothing could be found:

set mixedList = [ 1:2, "two":4, #three:8 ]

put getAProp( mixedList, 1 ) -- 2 put getAProp( mixedList, "1" ) -- 2 put getAProp( mixedList, #1 ) -- 2 -- "put the 1 of mixedList" will not work, "the 1" is not a property.
put getAProp( mixedList, 2 ) -- <Void> put getAProp( mixedList, "two" ) -- 4 put getAProp( mixedList, "TWO" ) -- <Void> put getAProp( mixedList, #two ) -- 4 put getAProp( mixedList, #TWO ) -- 4 put the two of mixedList -- 4 put the TWO of mixedList -- 4
put getAProp( mixedList, 3 ) -- <Void> put getAProp( mixedList, "three" ) -- 8 put getAProp( mixedList, "THREE" ) -- <Void> put getAProp( mixedList, #three ) -- 8 put getAProp( mixedList, #THREE ) -- 8 put the three of mixedList -- 8 put the THREE of mixedList -- 8