• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: does property exists in a record
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: does property exists in a record


  • Subject: Re: does property exists in a record
  • From: email@hidden
  • Date: Mon, 13 Aug 2001 09:51:10 -0400

On Sun, 12 Aug 2001 19:13:15 -0700, From: Paul Berkowitz <email@hidden>

> On 8/12/01 6:59 PM, "Timothy Bates" <email@hidden> wrote:
>
> > I think that AppleScript would be enhanced if all arrays were associative.
> > This can be done transparently - array items simply take their item index as
> > a default name.
>
> But records in AppleScript don't have item indices: records are unordered.
> {a:1, b:2} = {b:2, a:1}. This is important and useful in many cases, so it
> wouldn't be at all easy to make records associative, just like that,
> although being able to coerce them to an ordered array - just as they can be
> coerced to an ordered list (without labels) in the order that they happen to
> find themselves, would be useful. And people who prefer these new-type
> ordered arrays to standard records could use them all the time instead, if
> they wished.

I can see two ways associative data structures could work. You could have text
strings as indices (like a Perl hash): 'item "Bob" of myList'

But what I think would be more powerful would be a filter reference form:

every item of myStruct where its a is "Bob"

This would enable any data type to be the 'index' rather than just a string, and
allow complex conditions as well.

every item of myStruct where its name contains "Bob" and it age > 42

I recall that making filter expressions part of AppleScript itself was on that
wish-list Chris had mentioned, as well.
--
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


  • Follow-Ups:
    • Re: does property exists in a record
      • From: Timothy Bates <email@hidden>
    • Re: does property exists in a record
      • From: Paul Berkowitz <email@hidden>
  • Prev by Date: Re: applescript-users digest, Vol 2 #955 - 14 msgs
  • Next by Date: Maintaining Large Scripts
  • Previous by thread: Hash arrays [was: does property exists in a record]
  • Next by thread: Re: does property exists in a record
  • Index(es):
    • Date
    • Thread