Umm, you could probably do if not voidP(getaProp(aPropList, #SomeProp)) then do something...
A test of void/null vs 0 usually comes out equivalent. If (not a) will always be true if a is either 0 or void, but an explicit voidP test should differentiate.
- Tab
At 08:44 PM 10/21/02, Mike Gralish wrote:
Oh the havoc caused by depending on getaProp to check for the existence of a
property in a list before referencing it... I used it in one of my utilities
for merging multiple lists & it led to an error that was a little difficult
to debug.
if getaProp(aPropList, #SomeProp) <> void then do something with #SomeProp
fails when aPropList = [#SomeProp: 0]
I've learned the hard way to test with findPos()
Mike
> However, there is a more useful function that does not have these shortcuts.
> Say you have a situation where the user might try to access pFruits[
> "pear" ], but that is not in the list. If you use [] or getProp (which are
> synonymous) you will get a script error. Alternatively, you can use
> getaProp, which does not cause an error, but simply returns VOID if the item
> is not in the list.
[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]