Re: Rogue list?
Re: Rogue list?
- Subject: Re: Rogue list?
- From: Bill Cheeseman <email@hidden>
- Date: Sat, 12 May 2001 11:44:40 -0400
on 5/12/01 10:18 AM, Paul Berkowitz at email@hidden wrote:
>
WHY does the Finder return an empty record rather than an empty list when
>
it's asked for a direct object including a plural?
Coming in late on this thread, so apologies if it's misdirected.
I have noticed a general lack of official guidance for developers on this
point, so it is not surprising that there is inconsistency among
applications (including the Finder). For the future, Apple could solve the
problem by publishing a specification of correct behavior.
My personal view is this: A property or command that returns a list when
there are multiple items should ALWAYS return a single-item list when there
is one item and an empty list when there are no items. This allows scripters
to use simple, straightforward loops without having to account for the
single-item case and without requiring a 'try/on error' test for the no-item
case. Scripters who need to handle the one-item and no-item cases would not
be impeded in doing so.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
The AppleScript Sourcebook - www.AppleScriptSourcebook.com
Vermont Recipes - www.stepwise.com/Articles/VermontRecipes