Re: Null
Re: Null
- Subject: Re: Null
- From: "Arthur J. Knapp" <email@hidden>
- Date: Fri, 10 Jan 2003 10:10:30 -0500
>
Date: Thu, 9 Jan 2003 11:40:02 -0800
>
Subject: Re: Null
>
From: Christopher Nebel <email@hidden>
>
On Thursday, January 9, 2003, at 12:47 AM, Gary Lists wrote:
>
> property myvar : missing value
>
>
>
> In what way should we be using that as an initial value, and what is
>
> the logical operator for comparison of that variable?
>
>
>
> if myvar = missing value -- this?
>
Yep, that's the correct form. Such a script is just using "missing
>
value" as a distinctive value to indicate that the property hasn't been
>
properly filled in yet. Using "missing value" this way is nice because
>
it's self-documenting, but it's not intrinsically better than, say, an
>
empty string or an empty list.
Right. Just to point out as an exaggerated example:
on GetItemAtIndex( a_list, an_index )
try
return item an_index of a_list
on error
return missing value
end
end
set the_item to GetItemAtIndex( my_list, 10 )
if ( the_item = missing value ) then --> whatever
In the above snippit, we have a handler that will always return a value
to the calling script, rather than erroring-out if there is an out-of-bounds
situation. This can be desirable in many situations. The key thing to
understand, however, is that the proper use of the GetItemAtIndex() handler
assumes that the passed list parameter has no items that are the special
value missing value. As a matter of convention, this is easier to guarantee
than it would be for an empty string or empty list.
{ Arthur Knapp, of <
http://www.STELLARViSIONs.com>
a r t h u r @ s t e l l a r v i s i o n s . c o m
"Safe the Nature" - political graffiti in Prague
}
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.