Re: missing value
Re: missing value
- Subject: Re: missing value
- From: email@hidden
- Date: Thu, 6 Sep 2001 21:31:22 -0400
On Thu, 6 Sep 2001 21:22:44 +0200, Brennan <email@hidden> asked,
To: applescript-users <email@hidden>
>
Browsing 'Applescript in a Nutshell' this morning, I came across something
called 'missing value', which looks > interesting, but it's not explained very
clearly.
>
>
According to the book, it's a dummy value inside returned lists where a value
should be expected. The example > given is using 'Network setup scripting' but
it's not clear whether it is something we can use outside of that > context.
>
>
I haven't had much luck with my little experiments. I hoped it could be used
as a general dummy value.
You can use it, but it doesn't have any magic properties, and almost no
applications, or Scripting Additions, or coercions, that treat it in any special
way. Its just an enumerated constant.
I use it myself in some cases, and it works fine. You can test for it, and set
things to it. Its handy as an out-of-band parameter value to say that this
parameter isn't provided, or an out-of-band return value to say nothing happened
or nothing is being returned. (Sometimes the string "" means 'nothing', or the
empty list {}, but sometimes you want to differentiate between a string with no
characters, as opposed to no string. Often, the distinction is like a Zen koan,
or Helen Keller falling in a forest, but sometimes the value is useful.) I've
used it as the initialization value for a property, to say "This property hasn't
been initialized", and I've used it in a handler that sent out e-mail to say
"There is no attachment."
Generally, I use it if it will help make the script read easier. There are
often other out-of-band values that can be used, like -1, 0, {}, or "", but
sometimes reading the words "missing value" explains things better.
--
Scott Norton Phone: +1-703-299-1656
DTI Associates, Inc. Fax: +1-703-706-0476
2920 South Glebe Road Internet: email@hidden
Arlington, VA 22206-2768 or email@hidden